changeset a877caf351d0 in modules/account_invoice:6.0
details:
https://hg.tryton.org/modules/account_invoice?cmd=changeset&node=a877caf351d0
description:
Prevent using the same account on tax than invoice
The total computation relies on the invoice account to be only used for
the
term lines.
issue11151
review366571002
(grafted from c06071662b824c75bc30ce5ee0af1bf3a4748478)
diffstat:
invoice.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diffs (24 lines):
diff -r 28f7a05bf0f8 -r a877caf351d0 invoice.py
--- a/invoice.py Tue Jan 25 23:30:35 2022 +0100
+++ b/invoice.py Sun Jan 30 01:19:23 2022 +0100
@@ -2637,6 +2637,20 @@
invoice=invoice.rec_name))
return super(InvoiceTax, cls).create(vlist)
+ @classmethod
+ def validate(cls, taxes):
+ super().validate(taxes)
+ for tax in taxes:
+ tax.check_same_account()
+
+ def check_same_account(self):
+ if self.account == self.invoice.account:
+ raise InvoiceTaxValidationError(
+ gettext('account_invoice.msg_invoice_same_account_line',
+ account=self.account.rec_name,
+ invoice=self.invoice.rec_name,
+ line=self.rec_name))
+
def get_move_lines(self):
'''
Return a list of move lines instances for invoice tax