Odoo Help


Domain : employee dropdown of particular department and job title

Fongoh Tayong
on 2/3/16, 4:56 AM 805 views


working on a repair module and have mechanic as field 

mechanic_id = fields.Many2one('hr.employee', string="Mechanic's In Charge")

In my view, i want to limit the employees in the dropdown to be employees only in "garage" department and job type "mechanic". 

This is my code

 <field name="mechanic_id" required="1" 
domain="('job_id.name', '=', 'Mechanic'),
('department_id.name', '=', 'Garage')" />

But it tells me name is not an attribute. 

Sorry if i have funny code, but what am i doing wrong?

--Jignesh Mehta--

Jignesh Mehta
On 2/3/16, 5:26 AM

Hello Fongoh,

Try this

<field name="mechanic_id" required="1"attrs="{'domain' : {'job_id': [('name', '=', 'Mechanic')], 'department_id': [('name', '=', 'Garage')]}}" />

Hope it will works for you.


Thanks Kingnesh, it worked very well. In case i want to set action and context of same filters, please, how do i achieve that?

Fongoh Tayong
on 2/3/16, 6:19 AM

Hello, You also can set domain in the action.

Jignesh Mehta
on 2/3/16, 6:35 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: 2/3/16, 4:56 AM
Seen: 805 times
Last updated: 2/3/16, 5:58 AM