From 61dad4d47132bbd528e42477492a61c13aa4bc64 Mon Sep 17 00:00:00 2001 From: Florian Gilbert Date: Fri, 27 Nov 2020 14:41:45 +0000 Subject: [PATCH] [FIX] account: check statement balance at each step Previously, the check to see if a statement ending balance is the same as the computed balance was only done when moving from draft to posted which is wrong as people can modify the balance of posted statement programmatically which is the case when using online synchronization for example. Now perform that check at each change of state: draft->posted and posted->processed. Also the indication in the view to indicate that the balance was not the same was only displayed in draft, we removed that constraints as user should always see if there is a problem. closes odoo/odoo#62879 X-original-commit: 69fc9b71e991983b5bcddc948ac4c3749e305a3f Related: odoo/enterprise#15155 Signed-off-by: Cedric Snauwaert (csn) Signed-off-by: Florian Gilbert --- addons/account/models/account_bank_statement.py | 1 + addons/account/views/account_bank_statement_views.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 02256221a0d..8148e4d5d60 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -426,6 +426,7 @@ class AccountBankStatement(models.Model): 'res_id': statement.id }) + self._check_balance_end_real_same_as_computed() self.write({'state': 'confirm', 'date_done': fields.Datetime.now()}) def button_validate_or_action(self): diff --git a/addons/account/views/account_bank_statement_views.xml b/addons/account/views/account_bank_statement_views.xml index 321ec61e743..d0d866657fc 100644 --- a/addons/account/views/account_bank_statement_views.xml +++ b/addons/account/views/account_bank_statement_views.xml @@ -78,7 +78,7 @@ account.bank.statement.tree account.bank.statement - +