From c9183d7e613f86c895d1fdf35407f83d6677c33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 13 Apr 2024 13:52:43 +0200 Subject: [PATCH] Do not fail to get product location for shipment without warehouse The warehouse of internal shipment is computed and may be empty if the from location does not have a warehouse. Closes #13129 (grafted from f4f85f4d31f0afe83bb8662d1c15ceecadbd753e) --HG-- branch : 6.0 --- modules/stock_product_location/location.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/stock_product_location/location.py b/modules/stock_product_location/location.py index c3f2a1ae7c..88646a5c1e 100644 --- a/modules/stock_product_location/location.py +++ b/modules/stock_product_location/location.py @@ -59,7 +59,8 @@ class Move(metaclass=PoolMeta): def set_product_location(self, field='to_location', **pattern): assert field in {'from_location', 'to_location'} - if getattr(self, 'shipment', None): + if (getattr(self, 'shipment', None) + and getattr(self.shipment, 'warehouse', None)): pattern.setdefault('warehouse', self.shipment.warehouse.id) elif getattr(self, 'production', None): pattern.setdefault('warehouse', self.production.warehouse.id)