From 08cc5f92f3e5a3efc813ada2f9bd5ed4b8526abe Mon Sep 17 00:00:00 2001 From: clesgow Date: Fri, 18 Nov 2022 09:08:31 +0000 Subject: [PATCH] [IMP] stock_dropshipping: remove warehouse_id from dropship types When a picking is a dropship type (i.e. having the vendors as source location and the customers as destination locations), then the warehouse_id is removed. This will add consistency between automatically generated "Dropship" type and the manually created ones. Part of task-2985735 closes odoo/odoo#106039 X-original-commit: efe7cfb0b94f485908c4e8510bd0ba6ff154018b Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Quentin Wolfs (quwo) --- addons/stock_dropshipping/models/stock.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/stock_dropshipping/models/stock.py b/addons/stock_dropshipping/models/stock.py index 951289b436f..a0382350d5c 100644 --- a/addons/stock_dropshipping/models/stock.py +++ b/addons/stock_dropshipping/models/stock.py @@ -34,3 +34,13 @@ class StockPicking(models.Model): def _compute_is_dropship(self): for picking in self: picking.is_dropship = picking.location_dest_id.usage == 'customer' and picking.location_id.usage == 'supplier' + + +class StockPickingType(models.Model): + _inherit = 'stock.picking.type' + + @api.depends('default_location_src_id', 'default_location_dest_id') + def _compute_warehouse_id(self): + super()._compute_warehouse_id() + if self.default_location_src_id.usage == 'supplier' and self.default_location_dest_id.usage == 'customer': + self.warehouse_id = False