From ddf425761561d5e5fbb3fea39083d5d2589fced3 Mon Sep 17 00:00:00 2001 From: marination Date: Fri, 29 Oct 2021 12:51:14 +0530 Subject: [PATCH] fix: Skip empty rows while updating unsaved BOM cost - Dont try to get valuation rate if row has no item code - Dont try to add exploded items if row has no item code --- erpnext/manufacturing/doctype/bom/bom.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 232e3a0b0ff4..2cd8f8c15af4 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -307,6 +307,9 @@ def update_cost(self, update_parent=True, from_child_bom=False, update_hour_rate existing_bom_cost = self.total_cost for d in self.get("items"): + if not d.item_code: + continue + rate = self.get_rm_rate({ "company": self.company, "item_code": d.item_code, @@ -599,7 +602,7 @@ def get_exploded_items(self): for d in self.get('items'): if d.bom_no: self.get_child_exploded_items(d.bom_no, d.stock_qty) - else: + elif d.item_code: self.add_to_cur_exploded_items(frappe._dict({ 'item_code' : d.item_code, 'item_name' : d.item_name,