跳至内容
菜单
此问题已终结
3 回复
5052 查看

Employee Manager must be able to read, write and create only their own team's Leave, Expense, Loan and Salary Advance data 

形象
丢弃

add a record rule

最佳答案

Hi Krithika,


You can add record rules to the corresponding models so that employee manager can see records of his team only. The below rule should help you to achieve your requirement.

with hr.employee as the Object model,

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

Furthermore you can display the details of people who belongs to his department only.
[('department_id.member_ids.user_id', '=', user.id)]
​​
形象
丢弃

Hello, do you have a solution like this one for sales team leader?

最佳答案

Hi,

For the Model Leave you can write a record rule to restrict the visibility of the records to his own team. For that create a record rule with the domain.

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

You can apply the above domain for the Leave model, once everything is fine for that model, similar concept you can implement for the other models too. Sometime you may have to alter some changes to the existing rules too.


For more info and examples of the rules in the leave model, you can have a look at this file: https://github.com/odoo/odoo/blob/master/addons/hr_holidays/security/hr_holidays_security.xml

Thanks

形象
丢弃
相关帖文 回复 查看 活动
2
12月 23
14903
0
10月 23
33
3
10月 23
789
1
10月 23
569
1
8月 23
2551