diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index b87445f646b..404eae2533a 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1508,10 +1508,12 @@ class MrpProduction(models.Model): for order in self: finish_moves = order.move_finished_ids.filtered(lambda m: m.product_id == order.product_id and m.state not in ('done', 'cancel')) # the finish move can already be completed by the workorder. - if finish_moves and not finish_moves.quantity_done: - finish_moves._set_quantity_done(float_round(order.qty_producing - order.qty_produced, precision_rounding=order.product_uom_id.rounding, rounding_method='HALF-UP')) - if finish_moves.has_tracking != 'none' and order.lot_producing_id: - finish_moves.move_line_ids.lot_id = order.lot_producing_id + for move in finish_moves: + if move.quantity_done: + continue + move._set_quantity_done(float_round(order.qty_producing - order.qty_produced, precision_rounding=order.product_uom_id.rounding, rounding_method='HALF-UP')) + if move.has_tracking != 'none' and order.lot_producing_id: + move.move_line_ids.lot_id = order.lot_producing_id # workorder duration need to be set to calculate the price of the product for workorder in order.workorder_ids: if workorder.state not in ('done', 'cancel'):