[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 <nboulif@users.noreply.github.com>
This commit is contained in:
Nasreddin (bon)
2020-11-30 17:14:35 +00:00
parent 0da98620ca
commit cc315748fc
+6 -1
View File
@@ -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'}