[FIX] account: Set accounting_date readonly when confirmed

Before this commit, `accounting_date` was editable when Bank Statement is confirmed which doesn't make any sense as it is meant to be used for creating accounting entries on Confirming.

In this commit, we set `accounting_date` readonly when Statment is confirmed

closes odoo/odoo#48298

X-original-commit: 0ca74b447313325be8f4a29a0e0ae3c9056e8039
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
Swapnesh Shah
2020-03-25 08:22:09 +00:00
committed by Laurent Smet
parent 38294dbc99
commit 4d352c17b9
@@ -237,7 +237,8 @@ class AccountBankStatement(models.Model):
balance_start = fields.Monetary(string='Starting Balance', states={'confirm': [('readonly', True)]}, compute='_compute_starting_balance', readonly=False, store=True)
balance_end_real = fields.Monetary('Ending Balance', states={'confirm': [('readonly', True)]}, compute='_compute_ending_balance', readonly=False, store=True)
accounting_date = fields.Date(string="Accounting Date", help="If set, the accounting entries created during the bank statement reconciliation process will be created at this date.\n"
"This is useful if the accounting period in which the entries should normally be booked is already closed.")
"This is useful if the accounting period in which the entries should normally be booked is already closed.",
states={'open': [('readonly', False)]}, readonly=True)
state = fields.Selection([('open', 'New'), ('confirm', 'Validated')], string='Status', required=True, readonly=True, copy=False, default='open')
currency_id = fields.Many2one('res.currency', compute='_compute_currency', string="Currency")
journal_id = fields.Many2one('account.journal', string='Journal', required=True, states={'confirm': [('readonly', True)]}, default=_default_journal, check_company=True)