From 2aa5d2a66673058d18886bc3fa4f925457e823ad Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Tue, 30 Nov 2021 15:13:15 +0000 Subject: [PATCH] account: Fix journal dashboard graph query order As the query results are set in a list of dicts relying on the position of the dicts inside the list, the SQL query must ensure the results returned by postgres are ordered properly so that it will match the order in which the dicts are defined inside the list. closes odoo/odoo#81978 X-original-commit: bac93bf56ff67a89f9381137b0c67642a302e6bb Signed-off-by: Laurent Smet --- addons/account/models/account_journal_dashboard.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 00123a8956f..e73435fb36e 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -188,7 +188,8 @@ class account_journal(models.Model): next_date = start_date + timedelta(days=7) query += " UNION ALL ("+select_sql_clause+" and invoice_date_due >= '"+start_date.strftime(DF)+"' and invoice_date_due < '"+next_date.strftime(DF)+"')" start_date = next_date - + # Ensure results returned by postgres match the order of data list + query += " ORDER BY aggr_date ASC" self.env.cr.execute(query, query_args) query_results = self.env.cr.dictfetchall() is_sample_data = True