From 606ba0a95abf1ca7bbe32d6d03263765d9f2ba50 Mon Sep 17 00:00:00 2001 From: Walid <103029491+Zodk2@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:27:21 +0100 Subject: [PATCH] Restore `granularity` key in `annotated_groupbys` Odoo will raise the following error when we try to show the `Sales` report: ``` File "/home/lubuntu/odoo-15.0/odoo/models.py", line 2144, in _read_group_fill_temporal granularity = first_a_gby['granularity'] Exception The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/lubuntu/odoo-15.0/odoo/http.py", line 643, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/lubuntu/odoo-15.0/odoo/http.py", line 301, in _handle_exception raise exception.with_traceback(None) from new_cause KeyError: 'granularity' ``` --- smile_base/models/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/smile_base/models/base.py b/smile_base/models/base.py index c65d137c..3dd107ae 100644 --- a/smile_base/models/base.py +++ b/smile_base/models/base.py @@ -207,6 +207,7 @@ def _read_group_process_groupby(self, gb, query): 'type': field_type, 'display_format': display_formats[gb_function or 'month'], 'interval': time_intervals[gb_function or 'month'], + 'granularity': gb_function or 'month', 'tz_convert': tz_convert, 'qualified_field': qualified_field, }