From f06554236fe2a8e84a270f5dc7e46f85fceb5b95 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 10 Mar 2022 18:09:09 +0530 Subject: [PATCH] fix: fetch new fields from routing to bom (backport #30169) (#30171) * fix: fetch new fields in bom from routing (cherry picked from commit 18e2a33a9be4d4efea13ce5711343413b31358b8) * fix: dont hardcode hour rate precision (cherry picked from commit 362102e802bb501312a39bb21810336de26696b9) # Conflicts: # erpnext/manufacturing/doctype/bom_operation/bom_operation.json * fix: resolve conflict Co-authored-by: Ankush Menat --- erpnext/manufacturing/doctype/bom/bom.py | 5 +++-- .../manufacturing/doctype/bom_operation/bom_operation.json | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index b97dcab632f..cde25a2bc22 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -192,12 +192,13 @@ class BOM(WebsiteGenerator): if self.routing: self.set("operations", []) fields = ["sequence_id", "operation", "workstation", "description", - "time_in_mins", "batch_size", "operating_cost", "idx", "hour_rate"] + "time_in_mins", "batch_size", "operating_cost", "idx", "hour_rate", + "set_cost_based_on_bom_qty"] for row in frappe.get_all("BOM Operation", fields = fields, filters = {'parenttype': 'Routing', 'parent': self.routing}, order_by="sequence_id, idx"): child = self.append('operations', row) - child.hour_rate = flt(row.hour_rate / self.conversion_rate, 2) + child.hour_rate = flt(row.hour_rate / self.conversion_rate, child.precision("hour_rate")) def set_bom_material_details(self): for item in self.get("items"): diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json index ec617f3aaa9..9877b2882af 100644 --- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json +++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json @@ -65,7 +65,8 @@ "label": "Hour Rate", "oldfieldname": "hour_rate", "oldfieldtype": "Currency", - "options": "currency" + "options": "currency", + "precision": "2" }, { "description": "In minutes", @@ -177,7 +178,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2021-09-13 16:45:01.092868", + "modified": "2022-03-10 06:19:08.462027", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Operation",