diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index 13a86c07fe7..8c1257fc4fc 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -8895,6 +8895,15 @@ msgstr "" msgid "You need to supply a Lot/Serial number for products %s." msgstr "" +#. module: stock +#: code:addons/stock/models/stock_picking.py:0 +#, python-format +msgid "" +"You should not use a planned internal transfer to move some products between" +" two warehouses. Instead, use an immediate internal transfer or the resupply" +" route." +msgstr "" + #. module: stock #: code:addons/stock/models/stock_warehouse.py:0 #, python-format diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 2707a9bccc4..e660fcff476 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -720,6 +720,15 @@ class Picking(models.Model): @api.onchange('location_id', 'location_dest_id') def _onchange_locations(self): + from_wh = self.location_id.warehouse_id + to_wh = self.location_dest_id.warehouse_id + is_immediate = self.immediate_transfer if self._origin else self._context.get('default_immediate_transfer') + if self.picking_type_id.code == 'internal' and not is_immediate and from_wh and to_wh and from_wh != to_wh: + return {'warning': { + 'title': _("Warning"), + 'message': _("You should not use a planned internal transfer to move some products between two warehouses. " + "Instead, use an immediate internal transfer or the resupply route.") + }} (self.move_ids | self.move_ids_without_package).update({ "location_id": self.location_id, "location_dest_id": self.location_dest_id