تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
8 الردود
4600 أدوات العرض

I'm using odoo v 11 and i want that the approve action for example in leaves module to be done only with the manager of the employee,for example i have employee "x" with a manager "z" and i have another employee "y" with a manager "w" . i want that the manager "w" could only approve the request of his employee "y". But i notice that if you have the right of manager you can approve to anyone even though you are not his manager.Is it a solution for that ?

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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)] 

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

If this is the situation what you can do is that, either add a record rule for the leaves such a way that the managers only see his employee leave requests or you can override the action of the approval button and check whether the approving user is the manager of the leave requested employees manager or not and raise the warning message.


Thanks

الصورة الرمزية
إهمال
الكاتب

Thanks, but can i create a record rule which allows managers to see their own employees only

Yes as described in answer, either create record rule or override the button action and make changes

الكاتب

What should i write in the domain filter ?

'employee_id.parent_id.user_id', '=', user.id

أفضل إجابة

Hi Dhouha,


As Niyas said you can create a new record rule and disable the current rule for Leaves/Manager for hr.leave object. I guess "[('department_id.member_ids.user_id', '=', user.id)]" domain will work fine. You can also modify the action_approve() method to check for the current user's department and raise an error. I will prefer the first method since department heads should not be able to see the leaves of employees who are not in their department.


Mihran

الصورة الرمزية
إهمال

Check this customization tips: https://goo.gl/8HgnCF

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يوليو 24
3103
1
يونيو 24
5496
1
أكتوبر 23
11366
1
أكتوبر 23
98
1
أغسطس 23
2194