diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index ab4dba26bc1..a5e87d1fdb9 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -494,17 +494,14 @@ class StockMoveLine(models.Model): # If a picking type is linked, we may have to create a production lot on # the fly before assigning it to the move line if the user checked both # `use_create_lots` and `use_existing_lots`. - if ml.lot_name: - if ml.product_id.tracking == 'lot' and not ml.lot_id: - lot = self.env['stock.production.lot'].search([ - ('company_id', '=', ml.company_id.id), - ('product_id', '=', ml.product_id.id), - ('name', '=', ml.lot_name), - ], limit=1) - if lot: - ml.lot_id = lot.id - else: - ml_ids_to_create_lot.add(ml.id) + if ml.lot_name and not ml.lot_id: + lot = self.env['stock.production.lot'].search([ + ('company_id', '=', ml.company_id.id), + ('product_id', '=', ml.product_id.id), + ('name', '=', ml.lot_name), + ], limit=1) + if lot: + ml.lot_id = lot.id else: ml_ids_to_create_lot.add(ml.id) elif not picking_type_id.use_create_lots and not picking_type_id.use_existing_lots: