Odoo Help


Filter context in search view

on 8/26/14, 11:01 AM 2,559 views

Hi everybody,

I am creating a filter avec the context based on the many2one field but I get an error.

More details : I would like to get a list of task works and group them by task_id and project_id.

  • So I created a menu item and search view based on project.task.work model.
  • This model has task_id field so I created the filter based on it and everything is going correctly
  • But the object doesn't have project_id field so when I try do write a filter base on project_id like this:

 <filter string="Project" name="project" icon="terp-folder-violet" context="{'group_by':'task_id._project_id'}"/>

I get this error :

AssertionError: Fields in 'groupby' must be regular database-persisted fields (no function or related fields), or function fields with store=True

Any help?





| 5 3 6
Jakarta, Indonesia
On 8/27/14, 5:29 AM

The error message explains the problem explicitly, i.e. the field you want to use for groupby (task_id.project_id) is not stored in project.task.work model.  If the requirement is to group by Project, then you need to do:

  1. Create a related field in project.task.work to hold the project_id of task_id and make it stored (e.g 'project_id' : fields.related('task_id', 'project_id', type='many2one', relation='project.project', store=True)
  2. After restarting and upgrading to initiate the new field, use that field instead in the groupby context.

Hi Jonh, I did it like you said. It is working correctly. Thanks

on 8/27/14, 7:48 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/26/14, 11:01 AM
Seen: 2559 times
Last updated: 3/16/15, 8:10 AM