mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 07:01:56 +00:00
refactor(stock): use get_all for warehouse subtree in capacity dashboard
Replace the raw lft/rgt SELECT with frappe.get_all(pluck="name"). Same result on MariaDB; valid under Postgres. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,12 +40,8 @@ def get_filters(item_code=None, warehouse=None, parent_warehouse=None, company=N
|
||||
filters.append(["company", "=", company])
|
||||
if parent_warehouse:
|
||||
lft, rgt = frappe.db.get_value("Warehouse", parent_warehouse, ["lft", "rgt"])
|
||||
warehouses = frappe.db.sql_list(
|
||||
"""
|
||||
select name from `tabWarehouse`
|
||||
where lft >=%s and rgt<=%s
|
||||
""",
|
||||
(lft, rgt),
|
||||
warehouses = frappe.get_all(
|
||||
"Warehouse", filters={"lft": [">=", lft], "rgt": ["<=", rgt]}, pluck="name"
|
||||
)
|
||||
filters.append(["warehouse", "in", warehouses])
|
||||
return filters
|
||||
|
||||
Reference in New Issue
Block a user