Skip to Content
Menu
This question has been flagged
1 Reply
3801 Views

i have develop a module to restrict only the group "attendance/manual attendance" to "edit/create" their attendance. Ps :The group "attendance/manager" has the right to create and modify the attendances My problem is even when i use these rules the group "attendance/manual attendance" has always the right to edit/create. Any idea for help please ?

 id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
 hr.access_hr_attendance_user,hr.attendance user,hr_attendance.model_hr_attendance,hr_attendance.group_hr_attendance,1,0,0,0
 hr.access_hr_attendance_manger,hr.attendance manager,hr_attendance.model_hr_attendance,hr_attendance.group_hr_attendance_manager,1,1,1,1



Avatar
Discard
Best Answer

Hi,

For this you have to add a record rule, either you can do it from the code or from the front end. Just activate the developer mode and navigate to Settings -> Technical -> Security -> Record rules, here check whether a rule exist for the model attendance and for the user group attendance/manual attendance, if exist open the rule and change it else create a new one. 

For the rule you can add the domain like this :  [('employee_id.user_id','=',user.id)] and tick the permission like edit and create and assign the group as Manual Attendance.



Thanks

Avatar
Discard
Author

Should i use both ir.model.access.csv file with rules and adding a record rules as you mention ?

Author

it shows error raise ValueError("Invalid field %r in leaf %r" % (left, str(leaf)))

ValueError: Invalid field 'employee_id.user_id' in leaf "<osv.ExtendedLeaf: ('employee_id.user_id', '=', 11) on hr_employee (ctx: )>"

which is object/model selected is it attendance itself ?

Author

hr.attendance

Related Posts Replies Views Activity
2
Feb 24
13188
1
Dec 22
3859
2
Dec 22
12724
2
Jun 22
4688
2
Jun 22
3504