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.base

Compute Method: _compute_presence_state

View 18.0
Inputs Method Outputs
  • company_id
  • company_id.hr_presence_control_login
  • user_id
  • user_id.im_status
  • id
  • active
- """
-         This method is overritten in several other modules which add additional
-         presence criterions. e.g. hr_attendance, hr_holidays
-         """
- employee_to_check_working = self.filtered(lambda e: 'offline' in str(e.user_id.im_status))
- working_now_list = employee_to_check_working._get_employee_working_now()
- for employee in self:
-             state = 'out_of_working_hour'
-             if employee.company_id.hr_presence_control_login:
-                 if employee.user_id._is_user_available():
-                     state = 'present'
-                 elif 'offline' in str(employee.user_id.im_status) and employee.id in working_now_list:
-                     state = 'absent'
-             if not employee.active:
-                 state = 'archive'
-             employee.hr_presence_state = state
  • hr_presence_state

Back to entity