From 2e2dbfaeb0d1ee5df3a45bbfe1a7cc84713ed5e2 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 26 Nov 2024 16:40:01 +0100 Subject: [PATCH] [FIX] account: statement end balance compute new lines In a form view, the default state for a new statement line is 'draft'. However, once it's saved is automatically posted. Remove if merged: https://github.com/odoo/odoo/pull/188675 TT51834 --- account_statement_base/models/account_bank_statement.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/account_statement_base/models/account_bank_statement.py b/account_statement_base/models/account_bank_statement.py index 1b292f8b..a12b858c 100644 --- a/account_statement_base/models/account_bank_statement.py +++ b/account_statement_base/models/account_bank_statement.py @@ -42,3 +42,12 @@ class AccountBankStatement(models.Model): ("statement_id", "=", self.id), ], } + + def _compute_balance_end(self): + # Consider new lines amount in the balance + # Remove if merged: https://github.com/odoo/odoo/pull/188675 + res = super()._compute_balance_end() + for stmt in self: + lines = stmt.line_ids.filtered(lambda x: not x._origin) + stmt.balance_end += sum(lines.mapped("amount")) + return res