diff --git a/modules/account_stock_eu/stock.py b/modules/account_stock_eu/stock.py index cded8c2433..15ee628dd4 100644 --- a/modules/account_stock_eu/stock.py +++ b/modules/account_stock_eu/stock.py @@ -486,7 +486,9 @@ class Move_Production(metaclass=PoolMeta): country = super().intrastat_from_country if self.from_location: if (self.from_location.type == 'production' - and self.production and self.production.warehouse.address): + and self.production + and getattr(self.production, 'warehouse', None) + and self.production.warehouse.address): country = self.production.warehouse.address.country return country @@ -496,7 +498,9 @@ class Move_Production(metaclass=PoolMeta): country = super().intrastat_to_country if self.to_location: if (self.to_location.type == 'production' - and self.production and self.production.warehouse.address): + and self.production + and getattr(self.production, 'warehouse', None) + and self.production.warehouse.address): country = self.production.warehouse.address.country return country