Skip to content
Snippets Groups Projects
Commit c3cefaf3 authored by Florian(flg)'s avatar Florian(flg)
Browse files

[FIX] account: Fix Journal Dashboard Running balance query


On Database having a postgresql server version superior or
equals than 14.0, a feature called memoization is caching
result of the lateral join made in this query.
This cache creates an issue that results that customers
have the same result for their bank journals.

By adding a LIMIT 1 at the end of the lateral join query,
the memoization is not enabled (according to query plan).
Another solution could be to change the condition of this
lateral join (currently ON True) for a condition on the
journal id but it was less efficient.

opw-3422495

closes odoo/odoo#136161

Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
parent 03cffc46
No related branches found
No related tags found
No related merge requests found
......@@ -553,6 +553,7 @@ class account_journal(models.Model):
AND move.state != 'cancel'
AND move.journal_id = journal.id
AND stl.internal_index >= COALESCE(statement.first_line_index, '')
LIMIT 1
) without_statement ON TRUE
WHERE journal.id = ANY(%s)
""", [(self.ids)])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment