From efab20b746e70d2d582a4ec115ebc9d41e9d4fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 19 Nov 2024 16:50:36 +0100 Subject: [PATCH] Add missing depends to counterpart intrastat property Since 6bd1cdd44b6d the counterpart property is used for lost and found move. Closes #13634 --- modules/account_stock_eu/stock.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/account_stock_eu/stock.py b/modules/account_stock_eu/stock.py index 895045855e..8075b49ff4 100644 --- a/modules/account_stock_eu/stock.py +++ b/modules/account_stock_eu/stock.py @@ -131,7 +131,9 @@ class Move(metaclass=PoolMeta): return self.intrastat_tariff_code.intrastat_uom @property - @fields.depends('from_location', 'shipment') + @fields.depends( + 'from_location', 'to_location', 'shipment', + methods=['intrastat_to_country']) def intrastat_from_country(self): if self.from_location: if self.from_warehouse and self.from_warehouse.address: @@ -140,11 +142,14 @@ class Move(metaclass=PoolMeta): and hasattr(self.shipment, 'intrastat_from_country')): return self.shipment.intrastat_from_country elif self.from_location.type == 'lost_found': - if self.to_location.type != 'lost_found': + if (self.to_location + and self.to_location.type != 'lost_found'): return self.intrastat_to_country @property - @fields.depends('to_location', 'shipment') + @fields.depends( + 'to_location', 'from_location', 'shipment', + methods=['intrastat_from_country']) def intrastat_to_country(self): if self.to_location: if self.to_warehouse and self.to_warehouse.address: @@ -153,7 +158,8 @@ class Move(metaclass=PoolMeta): and hasattr(self.shipment, 'intrastat_to_country')): return self.shipment.intrastat_to_country elif self.to_location.type == 'lost_found': - if self.from_location.type != 'lost_found': + if (self.from_location + and self.from_location.type != 'lost_found'): return self.intrastat_from_country @classmethod