mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-19 23:12:13 +00:00
fix: BOM Creator Recursion Error on duplicate save (#41622)
(cherry picked from commit 9cfe09bdf6)
Co-authored-by: Richard Case <110036763+casesolved-co-uk@users.noreply.github.com>
This commit is contained in:
@@ -156,12 +156,12 @@ class BOMCreator(Document):
|
|||||||
amount = self.get_raw_material_cost()
|
amount = self.get_raw_material_cost()
|
||||||
self.raw_material_cost = amount
|
self.raw_material_cost = amount
|
||||||
|
|
||||||
def get_raw_material_cost(self, fg_reference_id=None, amount=0):
|
def get_raw_material_cost(self, fg_item=None, amount=0):
|
||||||
if not fg_reference_id:
|
if not fg_item:
|
||||||
fg_reference_id = self.name
|
fg_item = self.item_code
|
||||||
|
|
||||||
for row in self.items:
|
for row in self.items:
|
||||||
if row.fg_reference_id != fg_reference_id:
|
if row.fg_item != fg_item:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not row.is_expandable:
|
if not row.is_expandable:
|
||||||
@@ -183,7 +183,7 @@ class BOMCreator(Document):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
row.amount = 0.0
|
row.amount = 0.0
|
||||||
row.amount = self.get_raw_material_cost(row.name, row.amount)
|
row.amount = self.get_raw_material_cost(row.item_code, row.amount)
|
||||||
row.rate = flt(row.amount) / (flt(row.qty) * flt(row.conversion_factor))
|
row.rate = flt(row.amount) / (flt(row.qty) * flt(row.conversion_factor))
|
||||||
|
|
||||||
amount += flt(row.amount)
|
amount += flt(row.amount)
|
||||||
|
|||||||
Reference in New Issue
Block a user