Do not fail on missing attribute in InvoiceTax._key

issue11136
review370911002
This commit is contained in:
Cédric Krier committed 2022-03-06 13:43:50 +01:00
1 parent 1d314d7280
commit acc178ad5b
1 file changed
+4 -2
+4 -2
View File
@@ -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):