fix: Zero division error while making finished good entry against the work order

This commit is contained in:
Rohit Waghchaure 2020-01-21 19:22:27 +05:30
parent 239f0d529e
commit 0cc4cf2cf5

View File

@ -484,7 +484,7 @@ class StockEntry(StockController):
if self.work_order \
and frappe.db.get_single_value("Manufacturing Settings", "material_consumption"):
bom_items = self.get_bom_raw_materials(d.transfer_qty)
raw_material_cost = sum([flt(d.qty)*flt(d.rate) for d in bom_items.values()])
raw_material_cost = sum([flt(row.qty)*flt(row.rate) for row in bom_items.values()])
if raw_material_cost:
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision("basic_rate"))