From 43de214bf2d0da20b7609e392d800b49465b483d Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" <agr@odoo.com> Date: Tue, 14 Jan 2020 08:10:05 +0000 Subject: [PATCH] [FIX] account: avoid base being included twice in group Create multiple tax and assign them to the same tax group. Create an invoice, with two lines, each one with one tax of the group. Save and click on "Preview" or print invoice. The tax group will be reported applied on just the first line This append because of 4d62a94a31c3967bfd34396a3448a3e925422634. Reverting commit to restore the former behavior in which the tax base amount is added for every line in which the tax group component is found. While this other behavior could be an issue for some user the behavior is more consistent accounting-wise and the template could easily be changed to adapt to user needs. opw-2170069 closes odoo/odoo#43254 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> --- addons/account/models/account_move.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index f810f194f286..3e48c7348aba 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1278,12 +1278,11 @@ class AccountMove(models.Model): res = {} # There are as many tax line as there are repartition lines done_taxes = set() - done_groups = set() for line in tax_lines: res.setdefault(line.tax_line_id.tax_group_id, {'base': 0.0, 'amount': 0.0}) res[line.tax_line_id.tax_group_id]['amount'] += line.price_subtotal tax_key_add_base = tuple(move._get_tax_key_for_group_add_base(line)) - if tax_key_add_base not in done_taxes and line.tax_line_id.tax_group_id not in done_groups: + if tax_key_add_base not in done_taxes: if line.currency_id != self.company_id.currency_id: amount = self.company_id.currency_id._convert(line.tax_base_amount, line.currency_id, self.company_id, line.date) else: @@ -1291,7 +1290,6 @@ class AccountMove(models.Model): res[line.tax_line_id.tax_group_id]['base'] += amount # The base should be added ONCE done_taxes.add(tax_key_add_base) - done_groups.add(line.tax_line_id.tax_group_id) res = sorted(res.items(), key=lambda l: l[0].sequence) move.amount_by_group = [( group.name, amounts['amount'], -- GitLab