Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SQL error on fetching RM in production plan #26592

Merged
merged 2 commits into from Jul 22, 2021

Conversation

ankush
Copy link
Member

@ankush ankush commented Jul 22, 2021

Problem:
sql error on fetching RM from production plan

Steps to reproduce:

  • Create new production plan
  • pick any item with BOM
  • Add material request warehouse
  • get RM > enter any warehouse (try a group warehouse-like ALL WH)

You'll get SQL error because the warehouse JSON is being sent to query instead of a parsed list.

Root cause:
The list is getting passed by reference and compared using not which would ignore the referenced list if it's empty and create new one instead.

if not warehouse_list:
warehouse_list = []

Solution:
check the passed reference for None, not for falseness.
refactor and avoid passing by reference / mutations.

@ankush ankush merged commit 4ee6571 into frappe:develop Jul 22, 2021
ankush added a commit to ankush/erpnext that referenced this pull request Jul 22, 2021
* fix: SQL error on fetching RM in production plan

* refactor: avoid passing by reference and mutations
ankush added a commit that referenced this pull request Jul 22, 2021
* fix: SQL error on fetching RM in production plan

* refactor: avoid passing by reference and mutations
asoral pushed a commit to asoral/erpnext that referenced this pull request Nov 12, 2021
* fix: SQL error on fetching RM in production plan

* refactor: avoid passing by reference and mutations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant