From c0a3311836988463ec9c39ac362f7b5e75fbbb6a Mon Sep 17 00:00:00 2001 From: bcornwellmott Date: Wed, 15 Jun 2016 11:16:12 -0700 Subject: [PATCH] Create Manufacture MRs for BOM Items Corrects an issue where items with BOMs have Purchase material request submitted instead of Manufacture material requests. --- .../production_planning_tool/production_planning_tool.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 7ef1d6a39c..4770781478 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -449,9 +449,12 @@ class ProductionPlanningTool(Document): "transaction_date": nowdate(), "status": "Draft", "company": self.company, - "requested_by": frappe.session.user, - "material_request_type": "Purchase" + "requested_by": frappe.session.user }) + if item_wrapper.default_bom: + material_request.update({"material_request_type": "Manufacture"}) + else: + material_request.update({"material_request_type": "Purchase"}) for sales_order, requested_qty in items_to_be_requested[item].items(): material_request.append("items", { "doctype": "Material Request Item",