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

Compute Method: _compute_worked_hours

View 19.0 View 20.0
Inputs Method Outputs
  • check_out
  • check_in
  • employee_id
  • break_duration
""" Computes the worked hours of the attendance record.
            The worked hours of resource with flexible calendar is computed as the difference
            between check_in and check_out, without taking into account the lunch_interval"""
for attendance in self:
            if attendance.check_out and attendance.check_in and attendance.employee_id:
-                 attendance.worked_hours = attendance._get_worked_hours_in_range(attendance.check_in, attendance.check_out)
+                 attendance.worked_hours = (
+                     time_to_float(attendance.check_out - attendance.check_in)
+                 ) - attendance.break_duration
            else:
                attendance.worked_hours = False
  • worked_hours

Back to entity