Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
How do I access the department_id through the user.id on a domain filter?
I created a rule with Leave as the object. My goal is to have the user see leaves only from employees of his/her department. I see that an employee is connected to the user by user.id and employee contains the field department_id.
None of the following domain filters worked:
I would say this is the right answer:
<field name="domain_force">[('department_id.member_ids.user_id', 'in', [user.id])]</field>
- user.id" - in the data model of OpenERP for res_users no way to hr_employee is possible
- therefore department_id.member_ids will just give back a list with employee_ids
- in hr.employee the field user_id is available - therefore the path deparment_id.member_ids.user_id is the right way
Try this one: (Settings > Technical > Record Rules)
<record id="record_rule_id" model="ir.rule">
<field name="name">Your Rule Name</field>
<field name="model_id" ref="module.your_model_id"/>
<field name="domain_force">['|', ('department_id', '=', False), (' department_id ','child_of',[user. department_id .id])]</field>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_read" eval="1"/>
<field name="perm_unlink" eval="1"/>
I hope this may help you.
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/26/13, 7:10 AM|
|Seen: 10839 times|
|Last updated: 2/27/18, 9:12 PM|