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