From 0c6bbbd7f3408eb2f2bcd1dbfb838fc92e2c0374 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Fri, 26 Jul 2019 09:36:25 +0200 Subject: [PATCH] Set states to tax template's invoice and credit note accounts The states should be consistent with the tax issue8530 review261891002 --- tax.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tax.py b/tax.py index fe865839b1..fcda5afd63 100644 --- a/tax.py +++ b/tax.py @@ -514,13 +514,23 @@ class TaxTemplate(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin): domain=[ ('type.statement', '=', 'balance'), ('closed', '!=', True), - ]) + ], + states={ + 'invisible': Eval('type') == 'none', + 'required': Eval('type') != 'none', + }, + depends=['type']) credit_note_account = fields.Many2One( 'account.account.template', 'Credit Note Account', domain=[ ('type.statement', '=', 'balance'), ('closed', '!=', True), - ]) + ], + states={ + 'invisible': Eval('type') == 'none', + 'required': Eval('type') != 'none', + }, + depends=['type']) account = fields.Many2One('account.account.template', 'Account Template', domain=[('parent', '=', None)], required=True) legal_notice = fields.Text("Legal Notice")