changeset d2f64e9fb493 in modules/account_invoice:6.2
details:
https://hg.tryton.org/modules/account_invoice?cmd=changeset&node=d2f64e9fb493
description:
Do not fail on missing attribute in InvoiceTax._key
issue11136
review370911002
(grafted from ac674a252a05d63c3ee61a277d7abeb394edc10f)
diffstat:
invoice.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (16 lines):
diff -r 59e7f7850f1a -r d2f64e9fb493 invoice.py
--- a/invoice.py Thu Feb 17 00:06:38 2022 +0100
+++ b/invoice.py Sun Mar 06 13:43:50 2022 +0100
@@ -2643,8 +2643,10 @@
@property
def _key(self):
# Same as _TaxKey
- tax_id = self.tax.id if self.tax else -1
- return (self.account.id, tax_id, self.base >= 0)
+ tax_id = self.tax.id if getattr(self, 'tax', None) else -1
+ account_id = (
+ self.account.id if getattr(self, 'account', None) else None)
+ return (account_id, tax_id, (getattr(self, 'base', 0) or 0) >= 0)
@classmethod
def check_modify(cls, taxes):