Skip to content

Commit

Permalink
fix: "update cost" should ignore overridden routing times frappe#29154
Browse files Browse the repository at this point in the history
fix: "update cost" should ignore overridden routing times
  • Loading branch information
ankush authored Jan 11, 2022
1 parent 75c8b25 commit 754596d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
10 changes: 0 additions & 10 deletions erpnext/manufacturing/doctype/bom/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,16 +530,6 @@ def update_rate_and_time(self, row, update_hour_rate = False):
row.hour_rate = (hour_rate / flt(self.conversion_rate)
if self.conversion_rate and hour_rate else hour_rate)

if self.routing:
time_in_mins = flt(frappe.db.get_value("BOM Operation", {
"workstation": row.workstation,
"operation": row.operation,
"parent": self.routing
}, ["time_in_mins"]))

if time_in_mins:
row.time_in_mins = time_in_mins

if row.hour_rate and row.time_in_mins:
row.base_hour_rate = flt(row.hour_rate) * flt(self.conversion_rate)
row.operating_cost = flt(row.hour_rate) * flt(row.time_in_mins) / 60.0
Expand Down
5 changes: 3 additions & 2 deletions erpnext/manufacturing/doctype/routing/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_sequence_id(self):
wo_doc.delete()

def test_update_bom_operation_time(self):
"""Update cost shouldn't update routing times."""
operations = [
{
"operation": "Test Operation A",
Expand Down Expand Up @@ -85,8 +86,8 @@ def test_update_bom_operation_time(self):
routing_doc.save()
bom_doc.update_cost()
bom_doc.reload()
self.assertEqual(bom_doc.operations[0].time_in_mins, 90)
self.assertEqual(bom_doc.operations[1].time_in_mins, 42.2)
self.assertEqual(bom_doc.operations[0].time_in_mins, 30)
self.assertEqual(bom_doc.operations[1].time_in_mins, 20)


def setup_operations(rows):
Expand Down

0 comments on commit 754596d

Please sign in to comment.