details:   https://code.tryton.org/tryton/commit/c95c653458c9
branch:    default
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
diffstat:

 modules/account_stock_eu/stock.py |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r eb5a0aefc773 -r c95c653458c9 modules/account_stock_eu/stock.py
--- a/modules/account_stock_eu/stock.py Sun Oct 05 17:44:47 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
 

Reply via email to