Merge pull request #49750 from aerele/support-49391

fix: get unconsumed qty as per BOM required qty
This commit is contained in:
rohitwaghchaure
2025-09-30 17:57:51 +05:30
committed by GitHub
2 changed files with 76 additions and 2 deletions

View File

@@ -2501,10 +2501,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)