diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 0d55f8bb5ee..a15e3649a10 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -354,8 +354,8 @@ class ProductionPlanningTool(Document): def get_projected_qty(self): items = self.item_dict.keys() item_projected_qty = frappe.db.sql("""select item_code, sum(projected_qty) - from `tabBin` where item_code in (%s) group by item_code""" % - (", ".join(["%s"]*len(items)),), tuple(items)) + from `tabBin` where item_code in (%s) and warehouse=%s group by item_code""" % + (", ".join(["%s"]*len(items)), '%s'), tuple(items + [self.purchase_request_for_warehouse])) return dict(item_projected_qty)