fix: Convert BOM line product quantity to the move's unit of measure before calculating the line quantity.
This commit is contained in:
parent
696d1a3b90
commit
12ec80e82c
@ -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')
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user