fix: calculate operating cost based on BOM Quantity (#27464)

* fix: calculate operating cost based on BOM Quantity

* fix: added test cases

(cherry picked from commit 2e2985e4f1)

# Conflicts:
#	erpnext/manufacturing/doctype/bom/bom.py
#	erpnext/manufacturing/doctype/bom/test_bom.py
#	erpnext/manufacturing/doctype/bom_operation/bom_operation.json
This commit is contained in:
rohitwaghchaure
2021-09-15 00:37:41 +05:30
committed by Mergify
parent f5160dc83d
commit 547b21e450
3 changed files with 17 additions and 0 deletions

View File

@@ -621,6 +621,12 @@ class BOM(WebsiteGenerator):
if d.set_cost_based_on_bom_qty:
operating_cost = flt(d.cost_per_unit) * flt(self.quantity)
base_operating_cost = flt(d.base_cost_per_unit) * flt(self.quantity)
<<<<<<< HEAD
=======
self.operating_cost += flt(operating_cost)
self.base_operating_cost += flt(base_operating_cost)
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
self.operating_cost += flt(operating_cost)
self.base_operating_cost += flt(base_operating_cost)

View File

@@ -140,7 +140,11 @@ class TestBOM(FrappeTestCase):
for op_row in bom.operations:
self.assertAlmostEqual(op_row.cost_per_unit, op_row.operating_cost / 2)
<<<<<<< HEAD
self.assertAlmostEqual(bom.operating_cost, op_cost / 2)
=======
self.assertAlmostEqual(bom.operating_cost, op_cost/2)
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
bom.delete()
def test_bom_cost_multi_uom_multi_currency_based_on_price_list(self):

View File

@@ -11,7 +11,10 @@
"col_break1",
"workstation",
"time_in_mins",
<<<<<<< HEAD
"fixed_time",
=======
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
"costing_section",
"hour_rate",
"base_hour_rate",
@@ -186,7 +189,11 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2022-08-22 01:18:33.547481",
=======
"modified": "2021-09-13 16:45:01.092868",
>>>>>>> 2e2985e4f1 (fix: calculate operating cost based on BOM Quantity (#27464))
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Operation",