From eb9afa40ea1ec7bcc540450a186b606da8353356 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Sun, 26 Jul 2026 16:03:09 +0530 Subject: [PATCH 1/2] fix: update operating cost when propagating workstation hour rate to routing --- erpnext/manufacturing/doctype/workstation/workstation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py index 64be85f6a2f..f89e7700db6 100644 --- a/erpnext/manufacturing/doctype/workstation/workstation.py +++ b/erpnext/manufacturing/doctype/workstation/workstation.py @@ -206,6 +206,7 @@ class Workstation(Document): ( frappe.qb.update(bom_op) .set(bom_op.hour_rate, self.hour_rate) + .set(bom_op.operating_cost, self.hour_rate * bom_op.time_in_mins / 60) .where(bom_op.parent.isin(bom_list) & (bom_op.workstation == self.name)) .run() ) From e08e119739617bd13802ccbcb0561b6ff5e6c53e Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Sun, 26 Jul 2026 16:15:53 +0530 Subject: [PATCH 2/2] test: assert operating cost is propagated to routing operations --- .../manufacturing/doctype/workstation/test_workstation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py index b0154cb96f5..1a3358f2592 100644 --- a/erpnext/manufacturing/doctype/workstation/test_workstation.py +++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py @@ -113,12 +113,13 @@ class TestWorkstation(ERPNextTestSuite): # update_bom_operation() (run on w1.save()) must write the new rate directly onto the # Routing's BOM Operation rows. This is the converted query's own effect (not the BOM # update_cost above) and is what silently skipped on Postgres when parenttype was 'routing'. - routing_op_rate = frappe.db.get_value( + routing_op_rate, routing_op_operating_cost = frappe.db.get_value( "BOM Operation", {"parent": routing_doc.name, "parenttype": "Routing", "workstation": "_Test Workstation A"}, - "hour_rate", + ["hour_rate", "operating_cost"], ) self.assertEqual(routing_op_rate, 250) + self.assertEqual(routing_op_operating_cost, 250) def make_workstation(*args, **kwargs):