diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index fa8f724beec..5267ec3f3a9 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -302,8 +302,6 @@ class StockMoveLine(models.Model): vals['company_id'] = self.env['stock.picking'].browse(vals['picking_id']).company_id.id if vals.get('quant_id'): vals.update(self._copy_quant_info(vals)) - if self.env.context.get('import_file') and vals.get('reserved_uom_qty'): - raise UserError(_("It is not allowed to import reserved quantity, you have to use the quantity directly.")) mls = super().create(vals_list) @@ -315,6 +313,8 @@ class StockMoveLine(models.Model): # If this picking is already done we should generate an # associated done move. for move_line in mls: + if self.env.context.get('import_file') and move_line.reserved_uom_qty and not move_line._should_bypass_reservation(move_line.location_id): + raise UserError(_("It is not allowed to import reserved quantity, you have to use the quantity directly.")) if move_line.move_id or not move_line.picking_id: continue if move_line.picking_id.state != 'done':