Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
789 มุมมอง

Hello,

I want to create record rule, that user assigned with that rule, can only view Own timesheets and department. It looks like:

Model: Analytic Line

Domain rule: [
('employee_id.department_id', '=',
user.employee_id.department_id.id)

]
I can see all user data in list view from department, but if I want to add new entry in time-sheets, many2one field employee_id field only show current user. 


What rules or access rights I need to be able to access users from department?


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,


To achieve both:


    Access to own and department timesheets, and


    Select any employee from the same department in the timesheet entry,


you need to define two separate record rules:


Record Rule on account.analytic.line (Timesheets):


[

  '|',

  ('employee_id.user_id', '=', user.id),

  ('employee_id.department_id.id', '=', user.employee_id.department_id.id)

]


Record Rule on hr.employee (Employee selection in timesheet form):


[('department_id.id', '=', user.employee_id.department_id.id)]


Make sure the user is linked to an employee (hr.employee), and they have the appropriate access rights for Timesheets.



Hope it helps.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 25
60
1
พ.ค. 25
66
1
ก.พ. 25
37
1
ก.พ. 25
750
2
ธ.ค. 24
912