diff --git a/addons/stock/wizard/stock_picking_return.py b/addons/stock/wizard/stock_picking_return.py index be19f5ed396..b7591fa70c6 100644 --- a/addons/stock/wizard/stock_picking_return.py +++ b/addons/stock/wizard/stock_picking_return.py @@ -24,10 +24,10 @@ class ReturnPicking(models.TransientModel): @api.model def default_get(self, fields): - if len(self.env.context.get('active_ids', list())) > 1: - raise UserError(_("You may only return one picking at a time.")) res = super(ReturnPicking, self).default_get(fields) if self.env.context.get('active_id') and self.env.context.get('active_model') == 'stock.picking': + if len(self.env.context.get('active_ids', list())) > 1: + raise UserError(_("You may only return one picking at a time.")) picking = self.env['stock.picking'].browse(self.env.context.get('active_id')) if picking.exists(): res.update({'picking_id': picking.id})