[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
pull/759/head
David 2024-11-26 16:40:01 +01:00
parent 204e473ed9
commit 2e2dbfaeb0
1 changed files with 9 additions and 0 deletions

View File

@ -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