Test if production has warehouse before reading its address
Closes #14307
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user