I want to group by computed field (type_client).
I know that I should make it store = True, but I cannot because the values are dynamic. Is there another option?
This is my function:
def act_show_supect(self): for objctf in self: for client in self.env['res.partner'].search([('user_id.id', '=', self.user_id.id), ('company_type', '=', 'company'), ('type_client', '=', 'suspect')]): if client.type_client == 'suspect': objctf.ensure_one() res = objctf.env['ir.actions.act_window'].for_xml_id( 'base', 'action_partner_form') res.update( context=dict( objctf.env.context, search_default_user_id_id=objctf.user_id.id, search_default_type_client='suspect', ), domain=[('user_id.id', '=', objctf.user_id.id), ('company_type', '=', 'company'), ('type_client', '=', 'suspect')] ) return res
And this is the error after execution:
File "E:\odoo11.0\odoo\models.py", line 1908, in read_group result = self._read_group_raw(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy) File "E:\odoo11.0\odoo\models.py", line 1946, in _read_group_raw assert gb_field.store and gb_field.column_type, "Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True" AssertionError: Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True
And i want to group by:
('type_client', '=', 'suspect')