| 1 | from odoo import models |
| 2 | |
| 3 | |
| 4 | class HrEmployee(models.Model): |
| 5 | _inherit = 'hr.employee' |
| 6 | |
| 7 | def _compute_presence_icon(self): |
| 8 | super()._compute_presence_icon() |
| 9 | dayfield = self._get_current_day_location_field() |
| 10 | for employee in self: |
| 11 | today_employee_location_id = employee.sudo().exceptional_location_id or employee[dayfield] |
| 12 | if employee.is_absent: |
| 13 | employee.hr_icon_display = f'presence_holiday_{"absent" if employee.hr_presence_state != "present" else "present"}' |
| 14 | employee.show_hr_icon_display = True |
| 15 | elif today_employee_location_id: |
| 16 | employee.hr_icon_display = f'presence_{today_employee_location_id.location_type}' |
| 17 | employee.show_hr_icon_display = True |