fix: Zero division error while fetching unconsumed materials (#27293)

`
This commit is contained in:
Marica 2021-09-01 18:49:12 +05:30 committed by GitHub
parent 72ece75b11
commit 9506c14d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1200,10 +1200,10 @@ class StockEntry(StockController):
wo_item_qty = item.transferred_qty or item.required_qty wo_item_qty = item.transferred_qty or item.required_qty
req_qty_each = ( wo_qty_consumed = flt(wo_item_qty) - flt(item.consumed_qty)
(flt(wo_item_qty) - flt(item.consumed_qty)) / wo_qty_to_produce = flt(work_order_qty) - flt(wo.produced_qty)
(flt(work_order_qty) - flt(wo.produced_qty))
) req_qty_each = (wo_qty_consumed) / (wo_qty_to_produce or 1)
qty = req_qty_each * flt(self.fg_completed_qty) qty = req_qty_each * flt(self.fg_completed_qty)
@ -1582,7 +1582,7 @@ class StockEntry(StockController):
if material_request and material_request not in material_requests: if material_request and material_request not in material_requests:
material_requests.append(material_request) material_requests.append(material_request)
frappe.db.set_value('Material Request', material_request, 'transfer_status', status) frappe.db.set_value('Material Request', material_request, 'transfer_status', status)
def update_items_for_process_loss(self): def update_items_for_process_loss(self):
process_loss_dict = {} process_loss_dict = {}
for d in self.get("items"): for d in self.get("items"):