diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py index 74ccdfd02aa..6173f40fb10 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py @@ -701,19 +701,21 @@ class ProductionPlan(Document): "project": self.project, } - key = (d.item_code, d.sales_order, d.sales_order_item, d.warehouse) + key = (d.item_code, d.sales_order, d.sales_order_item, d.warehouse, d.planned_start_date) if self.combine_items: - key = (d.item_code, d.sales_order, d.warehouse) + key = (d.item_code, d.sales_order, d.warehouse, d.planned_start_date) if not d.sales_order: - key = (d.name, d.item_code, d.warehouse) + key = (d.name, d.item_code, d.warehouse, d.planned_start_date) if not item_details["project"] and d.sales_order: item_details["project"] = frappe.get_cached_value("Sales Order", d.sales_order, "project") if self.get_items_from == "Material Request": item_details.update({"qty": d.planned_qty}) - item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details + item_dict[ + (d.item_code, d.material_request_item, d.warehouse, d.planned_start_date) + ] = item_details else: item_details.update( { diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index b4b0468a0dd..25fc4f26247 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -867,7 +867,7 @@ class TestProductionPlan(FrappeTestCase): items_data = pln.get_production_items() # Update qty - items_data[(pln.po_items[0].name, item, None)]["qty"] = qty + items_data[(pln.po_items[0].name, item, None, pln.po_items[0].planned_start_date)]["qty"] = qty # Create and Submit Work Order for each item in items_data for _key, item in items_data.items():