summaryrefslogtreecommitdiff
path: root/addons/calendar
diff options
context:
space:
mode:
authorNasreddin (bon) <bon@odoo.com>2020-11-30 13:43:01 +0000
committerNasreddin (bon) <bon@odoo.com>2020-11-30 13:51:22 +0000
commita2388931710e1043540bbf2de131d4783af17d0b (patch)
treec9a2fc5473e6b09c235ef53a678ee5bf7cd7cdc1 /addons/calendar
parent661f687256995452756d6396308bcc167a5dcb9f (diff)
[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#62617 Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
Diffstat (limited to 'addons/calendar')
-rw-r--r--addons/calendar/models/calendar_event.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/calendar/models/calendar_event.py b/addons/calendar/models/calendar_event.py
index d1e65a3dc71..27a6a2a006d 100644
--- a/addons/calendar/models/calendar_event.py
+++ b/addons/calendar/models/calendar_event.py
@@ -107,8 +107,13 @@ class Meeting(models.Model):
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'}