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 <las@odoo.com>
This commit is contained in:
Akim Juillerat
2022-01-06 08:34:57 +00:00
parent 1906dbfe4e
commit 2aa5d2a666
@@ -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