-
Notifications
You must be signed in to change notification settings - Fork 9.9k
fix: remove disabled warehouse in get_warehouses_based_on_account #50385
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
Conversation
📝 WalkthroughWalkthroughThe change updates Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
erpnext/stock/doctype/warehouse/warehouse.py (1)
245-250: Consider filtering disabled warehouses in the fallback query for consistency.The fallback query on Line 250 retrieves warehouses when using the company's default inventory account, but it doesn't filter out disabled warehouses. For consistency with the main query fix and to ensure the function consistently excludes disabled warehouses in all scenarios, consider adding the same filter here.
Apply this diff to add the disabled filter:
warehouses = [d.name for d in frappe.get_all("Warehouse", filters={"is_group": 0})] + warehouses = [d.name for d in frappe.get_all("Warehouse", filters={"is_group": 0, "disabled": 0})]
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
erpnext/stock/doctype/warehouse/warehouse.py(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: sagarvora
Repo: frappe/erpnext PR: 49312
File: erpnext/public/js/utils/barcode_scanner.js:410-420
Timestamp: 2025-08-25T19:03:55.265Z
Learning: In ERPNext barcode scanner functionality, the set_warehouse method is intentionally designed to only use last_scanned_warehouse and not fall back to default_warehouse, as the default_warehouse is automatically handled by the backend scan API's _update_default_warehouse function which already considers all relevant warehouse defaults and business rules.
Learnt from: karm1000
Repo: frappe/erpnext PR: 48865
File: erpnext/public/js/utils/barcode_scanner.js:0-0
Timestamp: 2025-08-12T06:51:14.897Z
Learning: In ERPNext barcode scanner functionality, the `default_warehouse` returned by the scan API already handles appropriate fallback logic through the backend `_update_default_warehouse` function, which uses `get_item_warehouse_` with context (including set_warehouse and company) to consider all relevant warehouse defaults and business rules.
🪛 GitHub Actions: Linters
erpnext/stock/doctype/warehouse/warehouse.py
[error] 239-239: check-ast failed: SyntaxError: invalid syntax at line 239 (unexpected token ':')
[error] 239-239: debug-statements failed: Could not parse AST due to SyntaxError at line 239
[error] 239-239: ruff: Failed to parse due to SyntaxError at line 239 (Unexpected token ':')
🪛 GitHub Actions: Patch
erpnext/stock/doctype/warehouse/warehouse.py
[error] 239-239: SyntaxError: invalid syntax. Likely an stray extra colon after the for loop (line shows: 'for d in frappe.get_all(...) : :').
🪛 GitHub Actions: Server (Mariadb)
erpnext/stock/doctype/warehouse/warehouse.py
[error] 239-239: SyntaxError: invalid syntax at line 239 due to an extra colon after the for loop ("for d in frappe.get_all(...): :").
🪛 Ruff (0.14.3)
erpnext/stock/doctype/warehouse/warehouse.py
239-239: Expected a simple statement
(invalid-syntax)
239-240: Expected a statement
(invalid-syntax)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
a5769e1 to
929d631
Compare
mihir-kandoi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the linter error
@mihir-kandoi but in the latest commit its indented is correct |
929d631 to
ff2d9bf
Compare
|
@NihalRoshanCK did it for you. To do it yourself next time just go through this once. |
…-50385 fix: remove disabled warehouse in get_warehouses_based_on_account (backport #50385)
Now the get_warehouses_based_on_account return the the warehouse that even it is disabled
and my Stock and Account Value Comparison coming wrong
Update in version-14 and version-15