From acc178ad5bf7f6c15599e8ce74f2aa982efd6f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 6 Mar 2022 13:43:50 +0100 Subject: [PATCH] Do not fail on missing attribute in InvoiceTax._key issue11136 review370911002 --- invoice.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/invoice.py b/invoice.py index b05b60df1f..1308636569 100644 --- a/invoice.py +++ b/invoice.py @@ -2736,8 +2736,10 @@ class InvoiceTax(sequence_ordered(), ModelSQL, ModelView): @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):