fix(pro-plan): Actual Qty of RM considering children in case source warehouse is a group warehouse

This commit is contained in:
Nabin Hait 2018-12-13 16:36:35 +01:00
parent 4f3fd030ae
commit 614559f234

View File

@ -499,7 +499,8 @@ def get_bin_details(row):
conditions = ""
warehouse = row.source_warehouse or row.default_warehouse or row.warehouse
if warehouse:
conditions = " and warehouse='{0}'".format(frappe.db.escape(warehouse))
lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"])
conditions = " and exists(select name from `tabWarehouse` where lft >= {0} and rgt <= {1} and name=`tabBin`.warehouse)".format(lft, rgt)
item_projected_qty = frappe.db.sql(""" select ifnull(sum(projected_qty),0) as projected_qty,
ifnull(sum(actual_qty),0) as actual_qty from `tabBin`