Merge pull request #16213 from nabinhait/pplan_fix

fix(pro-plan): Actual Qty of RM considering children in case source warehouse is a group warehouse
This commit is contained in:
Nabin Hait 2019-01-10 17:57:28 +05:30 committed by GitHub
commit 7e3c80bd8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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`