Merge pull request #20377 from rohitwaghchaure/zero_division_qty_error_while_completing_fg_entry_develop

fix: Zero division error while making finished good entry against the…
This commit is contained in:
rohitwaghchaure 2020-01-22 17:01:59 +05:30 committed by GitHub
commit 5987eef32a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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"))