From c3cefaf3ba55cc0260ca93d68eb7caa49ca08bee Mon Sep 17 00:00:00 2001 From: "Florian(flg)" <flg@odoo.com> 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#136161 Signed-off-by: William André (wan) <wan@odoo.com> --- 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 6939c09fea51..2e580fab245d 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -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)]) -- GitLab