From cc315748fc462956cfd4ea7c5c6bb0087a8a28e9 Mon Sep 17 00:00:00 2001 From: "Nasreddin (bon)" Date: Mon, 30 Nov 2020 13:43:01 +0000 Subject: [PATCH] [FIX] calendar: Can't group by custom fields Issue - Install "Calendar" and "Studio" modules - Go to Calendar app an open any event - Switch to Studio mode - Add a selection field X in the form then close Studio - Go to list view and try group by X Error message : "Grouping by X is not allowed." Cause `_get_public_fields` does not get custom fields created with studio. Solution Add custom fields to public fields. opw-2402667 closes odoo/odoo#62640 X-original-commit: a2388931710e1043540bbf2de131d4783af17d0b Signed-off-by: bon-odoo --- addons/calendar/models/calendar_event.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/calendar/models/calendar_event.py b/addons/calendar/models/calendar_event.py index 1192cc0bdbf..f01f03fb1d0 100644 --- a/addons/calendar/models/calendar_event.py +++ b/addons/calendar/models/calendar_event.py @@ -106,9 +106,14 @@ class Meeting(models.Model): def _get_time_fields(self): return {'start', 'stop', 'start_date', 'stop_date'} + @api.model + def _get_custom_fields(self): + all_fields = self.fields_get(attributes=['manual']) + return {fname for fname in all_fields if all_fields[fname]['manual']} + @api.model def _get_public_fields(self): - return self._get_recurrent_fields() | self._get_time_fields() | { + return self._get_recurrent_fields() | self._get_time_fields() | self._get_custom_fields() | { 'id', 'active', 'allday', 'duration', 'user_id', 'interval', 'count', 'rrule', 'recurrence_id', 'show_as'}