Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Employees

Entity: hr.employee

Compute Method: _compute_presence_icon

View 19.0 View 20.0
Inputs Method Outputs
  • hr_presence_state
  • user_id
"""
        This method compute the state defining the display icon in the kanban view.
        It can be overriden to add other possibilities, like time off or attendances recordings.
        """
+ dayfield = self._get_current_day_location_field()
for employee in self:
-             employee.hr_icon_display = 'presence_' + employee.hr_presence_state
-             employee.show_hr_icon_display = bool(employee.user_id)
+             today_employee_location_id = employee.sudo().exceptional_location_id or employee[dayfield]
+             if not today_employee_location_id:
+                 employee.hr_icon_display = 'presence_' + employee.hr_presence_state
+                 employee.show_hr_icon_display = bool(employee.user_id)
+             else:
+                 employee.hr_icon_display = f'presence_{today_employee_location_id.location_type}'
+                 employee.show_hr_icon_display = True
  • hr_icon_display
  • show_hr_icon_display

Back to entity