Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter in Many2one

Tags:

odoo

odoo-8

I need Many2one field only show names that are in a specific group. For example: show all members from group purchase_managers in drop down. Please help me =)

I have .py

assigned_to = fields.Many2one('res.users', 'Approver', 
                              track_visibility='onchange')

view

 <field name="assigned_to"
                               attrs="{'readonly': [('is_editable','=', False)]}"/>
like image 662
Felipe Lopes Avatar asked May 19 '26 09:05

Felipe Lopes


1 Answers

We can handle it in .py file with domain attribute.

domain=[('field_name', 'operator', value)])

Try with following code:

assigned_to = fields.Many2one('res.users', 'Approver', 
          track_visibility='onchange', domain=[('is_editable', '=', True)])

Result:

It will load data which User has is_editable checked.

like image 52
Bhavesh Odedra Avatar answered May 21 '26 23:05

Bhavesh Odedra