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_validated_overtime_hours

Inputs Method Outputs
no_validation = self.filtered(lambda a: a.employee_id.company_id.attendance_overtime_validation == 'no_validation')
with_validation = self - no_validation
for attendance in with_validation:
            if attendance.overtime_status == 'to_approve':
                attendance.validated_overtime_hours = attendance.overtime_hours
            elif attendance.overtime_status == 'refused':
                attendance.validated_overtime_hours = 0
for attendance in no_validation:
            if isinstance(attendance.id, models.NewId):
                # We ignore NewId records here as we want to make sure a new value means it has been manually set by the user.
                continue
            attendance.validated_overtime_hours = attendance.overtime_hours

Back to entity