From b3d68e95ab9c3a1e9f080f1161007ceefb94120f Mon Sep 17 00:00:00 2001 From: "Florian(flg)" Date: Thu, 21 Sep 2023 16:10:08 +0200 Subject: [PATCH] [FIX] account: Fix Journal Dashboard Running balance query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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#136498 X-original-commit: 0ccdd9344e2192049aa196f419abac7eb59e4f1a Signed-off-by: William André (wan) Signed-off-by: Florian Gilbert (flg) --- addons/account/models/account_journal_dashboard.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index b87bc7fe396..e4c3146dabf 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -583,6 +583,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)])