From 4d352c17b991ad1dba730d5ce9b209f35241b6e5 Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Sun, 26 Jan 2020 18:14:31 +0000 Subject: [PATCH] [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 Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/account_bank_statement.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index d3907af0e3d..27d99736bbc 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -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)