From 79f98810b112c131dbba5261cb0c2ec2dc8e8b70 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Wed, 9 Dec 2020 13:46:46 +0000 Subject: [PATCH] [IMP] account: Allow locking the period with cancelled statement lines This case shouldn't appear in a normal usage of the statement lines because there is no way to cancel them. However, this case should be supported in 14.0 due to a choice we made for the migration. Indeed, we don't want to create draft journal entries in a locked period during the migration but the statement lines that are not reconciled in a locked period shouldn't be deleted in order to keep the statement starting/ending balance consistency. So, the journal entries created in a locked period for not reconciled statement lines are cancelled and then, we don't want to block the locking of any period because of that. closes odoo/odoo#63104 X-original-commit: b5e186124de69061e91f657e1a330ba019614256 Signed-off-by: oco-odoo --- addons/account/models/company.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/models/company.py b/addons/account/models/company.py index b1d5b151259..07a91dbc746 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -229,6 +229,7 @@ class ResCompany(models.Model): ('company_id', 'in', self.ids), ('is_reconciled', '=', False), ('date', '<=', values['fiscalyear_lock_date']), + ('move_id.state', 'in', ('draft', 'posted')), ]) if unreconciled_statement_lines: error_msg = _("There are still unreconciled bank statement lines in the period you want to lock."