Merge pull request #39953 from frappe/mergify/bp/version-15-hotfix/pr-39942
fix: group node in warehouse filter in Item-wise Sales Register (backport #39942)
This commit is contained in:
commit
18fcbb6f97
@ -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"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user