details: https://code.tryton.org/tryton/commit/7eaebcb012b5
branch: 7.6
user: Sergi Almacellas Abellana <[email protected]>
date: Tue Oct 21 18:24:52 2025 +0200
description:
Test if production has warehouse before reading its address
Closes #14307
(grafted from c95c653458c96247d0c75548eb16027e13eaba83)
diffstat:
modules/account_stock_eu/stock.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r 651ec8d535df -r 7eaebcb012b5 modules/account_stock_eu/stock.py
--- a/modules/account_stock_eu/stock.py Sat Oct 11 15:06:20 2025 +0200
+++ b/modules/account_stock_eu/stock.py Tue Oct 21 18:24:52 2025 +0200
@@ -486,7 +486,9 @@
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 @@
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