changeset 6573361e363a in modules/account_tax_rule_country:5.0 details: https://hg.tryton.org/modules/account_tax_rule_country?cmd=changeset&node=6573361e363a description: Ignore address of sale and purchase with empty warehouse
issue10401 review362021002 (grafted from 3afa6cea9ad288bffb28641744f02005b596efce) diffstat: account.py | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diffs (29 lines): diff -r a42ae48b7e3d -r 6573361e363a account.py --- a/account.py Thu Jun 17 21:51:34 2021 +0200 +++ b/account.py Wed Jun 09 08:31:59 2021 +0200 @@ -55,15 +55,19 @@ if (SaleLine and isinstance(self.origin, SaleLine) and self.origin.id >= 0): - if self.origin.warehouse.address: - from_country = self.origin.warehouse.address.country - to_country = self.origin.sale.shipment_address.country + warehouse = self.origin.warehouse + if warehouse and warehouse.address: + from_country = warehouse.address.country + shipment_address = self.origin.sale.shipment_address + to_country = shipment_address.country elif (PurchaseLine and isinstance(self.origin, PurchaseLine) and self.origin.id >= 0): - from_country = self.origin.purchase.invoice_address.country - if self.origin.purchase.warehouse.address: - to_country = self.origin.purchase.warehouse.address.country + invoice_address = self.origin.purchase.invoice_address + from_country = invoice_address.country + warehouse = self.origin.purchase.warehouse + if warehouse and warehouse.address: + to_country = warehouse.address.country pattern['from_country'] = from_country.id if from_country else None pattern['to_country'] = to_country.id if to_country else None