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)