From 8f3a9291c373854e2b84cd0a4e3f2ca401f720d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 27 Aug 2021 09:03:48 +0200 Subject: [PATCH] Support accounts on tax of type 'none' And update the account of invoice tax if the base change. issue10656 review334711002 --- invoice.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/invoice.py b/invoice.py index f132a8cd29..807e259d9a 100644 --- a/invoice.py +++ b/invoice.py @@ -2602,6 +2602,14 @@ class InvoiceTax(sequence_ordered(), ModelSQL, ModelView): else: self.account = tax.credit_note_account + @fields.depends('base', 'tax') + def on_change_base(self): + if self.base is not None and self.tax: + if self.base >= 0: + self.account = self.tax.invoice_account + else: + self.account = self.tax.credit_note_account + @fields.depends('tax', 'base', 'amount', 'manual', 'invoice', '_parent_invoice.currency') def on_change_with_amount(self):