[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 <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Laurent Smet
2021-02-19 17:54:11 +00:00
parent 8aecb15970
commit 62dc50bf7e
2 changed files with 6 additions and 4 deletions
+3 -3
View File
@@ -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):
+3 -1
View File
@@ -28,7 +28,9 @@
<field name="repartition_type"/>
<field name="account_id" attrs="{'invisible': [('repartition_type', '=', 'base')]}" options="{'no_create': True}"/>
<field name="tag_ids" widget="many2many_tags" options="{'no_create': True}" domain="[('applicability', '=', 'taxes'), ('country_id', '=', tax_fiscal_country_id)]"/>
<field name="use_in_tax_closing" optional="hidden" />
<field name="use_in_tax_closing"
optional="hidden"
attrs="{'invisible': [('repartition_type', '=', 'base')]}"/>
<field name="tax_fiscal_country_id" invisible="1"/>
<field name="company_id" invisible="1"/>
</tree>