Merge pull request #5481 from bcornwellmott/patch-2
Create Manufacture MRs for BOM Items
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 7ef1d6a..4770781 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 @@
"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",