mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-22 11:44:11 +00:00
fix: group node in warehouse filter in Item-wise Sales Register
(cherry picked from commit 44538bd02a)
This commit is contained in:
@@ -350,7 +350,13 @@ def get_conditions(filters, additional_conditions=None):
|
|||||||
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
|
||||||
|
|
||||||
if filters.get("warehouse"):
|
if filters.get("warehouse"):
|
||||||
conditions += """and ifnull(`tabSales Invoice Item`.warehouse, '') = %(warehouse)s"""
|
if frappe.db.get_value("Warehouse", filters.get("warehouse"), "is_group"):
|
||||||
|
lft, rgt = frappe.db.get_all(
|
||||||
|
"Warehouse", filters={"name": filters.get("warehouse")}, fields=["lft", "rgt"], as_list=True
|
||||||
|
)[0]
|
||||||
|
conditions += f"and ifnull(`tabSales Invoice Item`.warehouse, '') in (select name from `tabWarehouse` where lft > {lft} and rgt < {rgt}) "
|
||||||
|
else:
|
||||||
|
conditions += """and ifnull(`tabSales Invoice Item`.warehouse, '') = %(warehouse)s"""
|
||||||
|
|
||||||
if filters.get("brand"):
|
if filters.get("brand"):
|
||||||
conditions += """and ifnull(`tabSales Invoice Item`.brand, '') = %(brand)s"""
|
conditions += """and ifnull(`tabSales Invoice Item`.brand, '') = %(brand)s"""
|
||||||
|
|||||||
Reference in New Issue
Block a user