[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 <smetl@users.noreply.github.com>
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
This commit is contained in:
Rémy Baranx (bar)
2021-02-11 10:34:57 +00:00
parent 2b4ccc326b
commit f240c987d8
@@ -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):