diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 895626dad85..a652ad54f04 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -2276,7 +2276,10 @@ class orm(orm_template): groupby = groupby[0] self._inherits_join_calc(groupby, query) - assert not groupby or groupby in fields, "Fields in 'groupby' must appear in the list of fields to read (perhaps it's missing in the list view?)" + if groupby: + assert not groupby or groupby in fields, "Fields in 'groupby' must appear in the list of fields to read (perhaps it's missing in the list view?)" + groupby_def = self._columns.get(groupby) or (self._inherit_fields.get(groupby) and self._inherit_fields.get(groupby)[2]) + assert groupby_def and groupby_def._classic_write, "Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True" fget = self.fields_get(cr, uid, fields) float_int_fields = filter(lambda x: fget[x]['type'] in ('float', 'integer'), fields)