From f240c987d8849594e863e98748e45ca91db34b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Baranx=20=28bar=29?= Date: Mon, 8 Feb 2021 14:32:37 +0000 Subject: [PATCH] [FIX] account: is_valid_balance_start computing According to its description, the field `is_valid_balance_start` of the `account_bank_statement` model shall be `False` if the starting balance of the current statement, is different from the previous ending balance. That means, it shall be set to `True` when no previous statement has been set (`previous_statement_id` is NULL), whatever the starting balance value. closes odoo/odoo#65941 X-original-commit: 096fcfa30b3ead8314b1162db357450a8c1b2a0e Signed-off-by: Laurent Smet Signed-off-by: Cedric Snauwaert (csn) --- addons/account/models/account_bank_statement.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index bf095c2a430..ea5adf82cbd 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -188,7 +188,13 @@ class AccountBankStatement(models.Model): @api.depends('balance_start', 'previous_statement_id') def _compute_is_valid_balance_start(self): for bnk in self: - bnk.is_valid_balance_start = float_is_zero(bnk.balance_start - bnk.previous_statement_id.balance_end_real, precision_digits=bnk.currency_id.decimal_places) + bnk.is_valid_balance_start = ( + bnk.currency_id.is_zero( + bnk.balance_start - bnk.previous_statement_id.balance_end_real + ) + if bnk.previous_statement_id + else True + ) @api.depends('date', 'journal_id') def _get_previous_statement(self):