From b90875575c20b05027aa1f9718db69e0d60ad133 Mon Sep 17 00:00:00 2001 From: Sagar Sharma Date: Sat, 17 Sep 2022 15:58:33 +0530 Subject: [PATCH] fix: make `po_detail` or `sco_rm_detail` mandatory for SE `Send to Subcontractor` --- erpnext/stock/doctype/stock_entry/stock_entry.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 75e8c6a817..62f2acd2fd 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -919,6 +919,16 @@ class StockEntry(StockController): ) if order_rm_detail: se_item.db_set(self.subcontract_data.rm_detail_field, order_rm_detail) + else: + if not se_item.allow_alternative_item: + frappe.throw( + _("Row {0}# Item {1} not found in 'Raw Materials Supplied' table in {2} {3}").format( + se_item.idx, + se_item.item_code, + self.subcontract_data.order_doctype, + self.get(self.subcontract_data.order_field), + ) + ) elif backflush_raw_materials_based_on == "Material Transferred for Subcontract": for row in self.items: if not row.subcontracted_item: