[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) <arm@odoo.com>
Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
This commit is contained in:
clesgow
2022-11-18 17:03:56 +01:00
parent cf1c432974
commit 08cc5f92f3
+10
View File
@@ -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