Ir al contenido
Menú
Se marcó esta pregunta

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
Mejor respuesta

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
Publicaciones relacionadas Respuestas Vistas Actividad
1
abr 23
2827
2
nov 23
2350
0
may 23
1605
0
jun 20
3438
0
may 18
3773