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

Module: Attendances

Entity: hr.employee

Compute Method: _compute_total_overtime

View 17.0 View 19.0
Inputs Method Outputs
  • company_id
  • company_id.hr_attendance_overtime
  • overtime_ids
+ mapped_validated_overtimes = dict(
+             self.env['hr.attendance.overtime.line']._read_group(
+             domain=[
+                 ('status', '=', 'approved'),
+                 ('employee_id', 'in', self.ids),
+             ],
+             groupby=['employee_id'],
+             aggregates=['manual_duration:sum']
+         ))
for employee in self:
-             if employee.company_id.hr_attendance_overtime:
-                 employee.total_overtime = float_round(sum(employee.overtime_ids.mapped('duration')), 2)
-             else:
-                 employee.total_overtime = 0
+             employee.total_overtime = mapped_validated_overtimes.get(employee, 0)
  • total_overtime

Back to entity