From 62dc50bf7e30016cb2c1a18c4f9d95e17f8ddd27 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Fri, 19 Feb 2021 14:25:02 +0000 Subject: [PATCH] [FIX] account: Fix use_in_tax_closing on 'base' lines This field shouldn't be visible on the view for 'base' repartition lines. closes odoo/odoo#66570 X-original-commit: 69ba2db0cb480c298400fa0bbcbb1a7aa9a0a96b Signed-off-by: oco-odoo Signed-off-by: Laurent Smet --- addons/account/models/account_tax.py | 6 +++--- addons/account/views/account_tax_views.xml | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index afa0e44a540..c85143e863b 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -641,12 +641,12 @@ class AccountTaxRepartitionLine(models.Model): help="The order in which distribution lines are displayed and matched. For refunds to work properly, invoice distribution lines should be arranged in the same order as the credit note distribution lines they correspond to.") use_in_tax_closing = fields.Boolean(string="Tax Closing Entry") - @api.onchange('account_id') + @api.onchange('account_id', 'repartition_type') def _on_change_account_id(self): - if not self.account_id: + if not self.account_id or self.repartition_type == 'base': self.use_in_tax_closing = False else: - self.use_in_tax_closing = not(self.account_id.internal_group == 'income' or self.account_id.internal_group == 'expense') + self.use_in_tax_closing = self.account_id.internal_group not in ('income', 'expense') @api.constrains('invoice_tax_id', 'refund_tax_id') def validate_tax_template_link(self): diff --git a/addons/account/views/account_tax_views.xml b/addons/account/views/account_tax_views.xml index 74e78d3e6e8..26862d825bd 100644 --- a/addons/account/views/account_tax_views.xml +++ b/addons/account/views/account_tax_views.xml @@ -28,7 +28,9 @@ - +