From 57a5c716634931d9f00a1329158916c2bf6cd6b7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 3 Mar 2015 18:26:06 +0530 Subject: [PATCH] Update rate in exploded_items on click of update cost btton --- erpnext/manufacturing/doctype/bom/bom.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 95595f26c93..36854b2d052 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -123,13 +123,19 @@ class BOM(Document): def update_cost(self): if self.docstatus == 2: return - + + items_rate = frappe._dict() for d in self.get("items"): rate = self.get_bom_material_detail({'item_code': d.item_code, 'bom_no': d.bom_no, 'qty': d.qty})["rate"] if rate: d.rate = rate - + items_rate.setdefault(d.item_code, d.rate) + + for e in self.get("exploded_items"): + if items_rate.get(e.item_code): + e.rate = items_rate.get(e.item_code) + if self.docstatus == 1: self.flags.ignore_validate_update_after_submit = True self.calculate_cost()