changeset ac674a252a05 in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset&node=ac674a252a05
description:
        Do not fail on missing attribute in InvoiceTax._key

        issue11136
        review370911002
diffstat:

 invoice.py |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (16 lines):

diff -r 8057570f55c1 -r ac674a252a05 invoice.py
--- a/invoice.py        Tue Feb 15 00:08:46 2022 +0100
+++ b/invoice.py        Sun Mar 06 13:43:50 2022 +0100
@@ -2736,8 +2736,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):

Reply via email to