Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
9434 Lượt xem

m using odoo v 11 and i want to create a record rule that allows managers to see only their own employees.i want to apply this rule for all the modules. What should i write in the domain filter? Any idea for help please?

Ảnh đại diện
Huỷ bỏ

Show records on TreeView that are related to Active User: https://goo.gl/F42kRf

Câu trả lời hay nhất

Hi Dhouha,

Add new record rule  ['|',('user_id', '=', user.id),('parent_id.user_id', '=', user.id)] for hr.employee this will filter the records and allows managers to see only their employees. If you have department id for each employee try this rule

[('department_id.member_ids.user_id', '=', user.id)]

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for your answer i tried your domain filter for the model hr.holidays but it shows the same results as if there is no record rule (it shows all the leaves request for all the employees)

Câu trả lời hay nhất

Hi,

If you need the Managers too see only their employee under the Employee menu, you need to add a record rule for the corresponding user group. In the record rule you can add the domain like this,

[('parent_id.user_id','=',user.id)]


Above domain only shows the employees who's manager is logged in user. If you need to display those employees for which the manager is not assigned, you can add a or condition along with the domain.

['|', ('parent_id', '=', False), ('parent_id.user_id','=',user.id)]


You can apply this rule for the model hr.employee, if the same has to be done for the other records like attendance, leaves etc, you have to add the rule for those models too.


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for your answer i tried both domain filter but everytime it shows the same results as if there is no record rule

Tác giả Câu trả lời hay nhất

i found the solution i should create a new record rule with the domain filter ['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id)] 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 24
2745
1
thg 6 24
5196
1
thg 10 23
10930
1
thg 10 23
98
1
thg 8 23
2194