[Fix] Stock Ageing report does not work with group warehouse (#13151)

This commit is contained in:
rohitwaghchaure 2018-03-05 11:00:42 +05:30 committed by Nabin Hait
parent a942722619
commit 67cfa81de2

View File

@ -96,6 +96,8 @@ def get_item_conditions(filters):
def get_sle_conditions(filters):
conditions = []
if filters.get("warehouse"):
conditions.append("warehouse=%(warehouse)s")
lft, rgt = frappe.db.get_value('Warehouse', filters.get("warehouse"), ['lft', 'rgt'])
conditions.append("""warehouse in (select wh.name from `tabWarehouse` wh
where wh.lft >= {0} and rgt <= {1})""".format(lft, rgt))
return "and {}".format(" and ".join(conditions)) if conditions else ""