[FIX] attendances: check if has sign in and out

This commit is contained in:
Samir Ladoui 2024-12-19 13:52:21 +01:00
parent edcdb4855a
commit bf9e55ca0a
1 changed files with 6 additions and 6 deletions

View File

@ -139,12 +139,12 @@ class HrAttendanceTransactions(models.Model):
if adjusted_sign_in and item.has_sign_out:
item.official_hours = adjusted_sign_out - adjusted_sign_in
# Check absence due to missing sign_out
if adjusted_sign_in and not item.has_sign_out:
current_time = fields.Datetime.now().hour
if calendar.end_sign_in > 0 and (current_time - adjusted_sign_in < calendar.end_sign_in):
item.is_absent = True
item.total_absent_hours = working_hours - (current_time - adjusted_sign_in)
# # Check absence due to missing sign_out
# if adjusted_sign_in and not item.has_sign_out:
# current_time = fields.Datetime.now().hour
# if calendar.end_sign_in > 0 and (current_time - adjusted_sign_in < calendar.end_sign_in):
# item.is_absent = True
# item.total_absent_hours = working_hours - (current_time - adjusted_sign_in)
# Handle absence due to insufficient working hours
if item.has_sign_out and adjusted_sign_out - adjusted_sign_in < working_hours: