diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index febc47e5f72..967df5bbf40 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1214,8 +1214,6 @@ class MrpProduction(models.Model): 'company_id': self.company_id.id, 'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env['ir.sequence'].next_by_code('stock.lot.serial'), }) - if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids: - self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids.lot_id = self.lot_producing_id if self.product_id.tracking == 'serial': self._set_qty_producing() @@ -1491,6 +1489,7 @@ class MrpProduction(models.Model): # 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 # workorder duration need to be set to calculate the price of the product for workorder in order.workorder_ids: