From ab7856ddcda0637700bee4195a0347024989aa76 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Tue, 21 Oct 2025 18:24:52 +0200 Subject: [PATCH] Test if production has warehouse before reading its address Closes #14307 --- modules/account_stock_eu/stock.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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