Skip to Content
Menú
This question has been flagged

I want to create new groups for managers with the correct settings, to be able to see the attendance, remaining time off and approval of time off, only for their team, preferably in "Employees" app for each team member. How to do it? Thanks

Avatar
Descartar
Best Answer

Define Custom Groups

Go to Settings > Users & Companies > Groups.

Click on Create and define a new group, e.g., "Team Manager."

Assign this group to the relevant applications, like "Employees" or "Attendances," by linking the appropriate access controls.

Restrict Employee Data

  • Navigate to Settings > Technical > Security > Access Control Lists.
  • Look for the hr.employee model.
  • Add a new rule for the "Team Manager" group with the following settings:
    • Read Access: Enabled
    • Write Access: Enabled
    • Create Access: Enabled
    • Delete Access: Disabled (if not required)
  • Use a domain filter to restrict access to the manager's team:

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

    This assumes the "parent_id" field links employees to their manager.
  • Repeat the process for the models hr.attendance and hr.leave.
  • Use similar domain filters to restrict visibility to records related to the manager's team.

Adjust Record Rules

Employees:

  • Go to Settings > Technical > Security > Record Rules.
  • Add a rule for the hr.employee model:
    • Name: "Team Manager Employee Rule"
    • Domain:

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

    • Groups: "Team Manager"

Attendances:

  • Add a rule for the hr.attendance model:
    • Name: "Team Manager Attendance Rule"
    • Domain:

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

    • Groups: "Team Manager"

Time-Offs:

  • Add a rule for the hr.leave model:
    • Name: "Team Manager Time-Off Rule"
    • Domain:

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

    • Groups: "Team Manager"

Add Manager View in the Employees App

Activate Developer Mode

Go to Employees > Configuration > Views.

Locate and edit the tree or form views for employees.

Add filters or groups to show team-specific data:

<filter string="My Team" domain="[('parent_id.user_id', '=', user.id)]"/>

Ensure the views are accessible only to the "Team Manager" group.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
d’abr. 23
2812
2
de nov. 23
2330
0
de maig 23
1496
0
de juny 20
3415
0
de maig 18
3745