mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 20:05:09 +00:00
fix: get unconsumed qty as per BOM qty
(cherry picked from commit cf4b395ee3)
This commit is contained in:
@@ -2279,10 +2279,12 @@ class StockEntry(StockController):
|
||||
|
||||
wo_item_qty = item.transferred_qty or item.required_qty
|
||||
|
||||
wo_qty_consumed = flt(wo_item_qty) - flt(item.consumed_qty)
|
||||
wo_qty_unconsumed = flt(wo_item_qty) - flt(item.consumed_qty)
|
||||
wo_qty_to_produce = flt(work_order_qty) - flt(wo.produced_qty)
|
||||
bom_qty_per_unit = item.required_qty / wo.qty # per-unit BOM qty
|
||||
|
||||
req_qty_each = (wo_qty_consumed) / (wo_qty_to_produce or 1)
|
||||
req_qty_each = (wo_qty_unconsumed) / (wo_qty_to_produce or 1)
|
||||
req_qty_each = min(req_qty_each, bom_qty_per_unit)
|
||||
|
||||
qty = req_qty_each * flt(self.fg_completed_qty)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user