From 12ec80e82c548200599cf17d765506873de04ffc Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Thu, 19 Mar 2026 09:54:31 +0700 Subject: [PATCH] fix: Convert BOM line product quantity to the move's unit of measure before calculating the line quantity. --- models/mrp_production.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/mrp_production.py b/models/mrp_production.py index e8a3c38..14a74fd 100644 --- a/models/mrp_production.py +++ b/models/mrp_production.py @@ -47,7 +47,8 @@ class MrpProduction(models.Model): if move.bom_line_id and self.bom_id: # Recalculate the clean truth directly from BOM clean_factor = round(self.product_uom_id._compute_quantity(self.product_qty, self.bom_id.product_uom_id, round=False) / self.bom_id.product_qty, 8) - line_quantity = round(clean_factor * move.bom_line_id.product_qty, 8) + bom_qty_in_move_uom = move.bom_line_id.product_uom_id._compute_quantity(move.bom_line_id.product_qty, move.product_uom, round=False) + line_quantity = round(clean_factor * bom_qty_in_move_uom, 8) from odoo.tools import float_round ideal_qty = float_round(line_quantity, precision_rounding=move.product_uom.rounding, rounding_method='UP') @@ -144,7 +145,9 @@ class MrpProduction(models.Model): continue # Calculate what the quantity SHOULD be according to BOM and MO Qty - line_quantity = round(clean_factor * move.bom_line_id.product_qty, 8) + bom_qty_in_move_uom = move.bom_line_id.product_uom_id._compute_quantity(move.bom_line_id.product_qty, move.product_uom, round=False) + line_quantity = round(clean_factor * bom_qty_in_move_uom, 8) + from odoo.tools import float_round ideal_qty = float_round(line_quantity, precision_rounding=move.product_uom.rounding, rounding_method='UP')