diff options
| author | Laurent Smet <las@odoo.com> | 2021-02-19 14:25:02 +0000 |
|---|---|---|
| committer | Laurent Smet <las@odoo.com> | 2021-02-19 14:25:02 +0000 |
| commit | 69ba2db0cb480c298400fa0bbcbb1a7aa9a0a96b (patch) | |
| tree | e00e34fef34963fd73b9efc0926f8419cab138ad /addons | |
| parent | c3aea6783b8bfb3af383ae881af247fa5507e99f (diff) | |
[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#66541
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_tax.py | 6 | ||||
| -rw-r--r-- | 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 7883788ec19..5554ea0c665 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -654,12 +654,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 @@ <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> |
