[FIX] attendances: FIX bug

This commit is contained in:
younes 2025-11-17 15:16:19 +01:00
parent ea38d1cc08
commit 97ebed566b
1 changed files with 3 additions and 2 deletions

View File

@ -342,8 +342,10 @@ class HrAttendanceReport(models.Model):
lateness + early_exist + extra_break_duration + total_absent) - lateness_hours_by_hr
else:
get_total_hours = (total_absent - lateness_hours_by_hr)
#print("_____________________________________get_total_hours",total_absent,lateness_hours_by_hr)
if get_total_hours < 0:
get_total_hours = 0
print("_____________________________________get_total_hours", get_total_hours)
if attendance.employee_id.contract_id.state == 'program_directory':
get_total_amount = attendance.employee_id.contract_id.total_allowance
if emp_calendar.is_full_day:
@ -397,8 +399,7 @@ class HrAttendanceReport(models.Model):
temp_dict["exist_hours"] = sum(item1["exist_hours"] for item1 in grp4)
temp_dict["extra_break_duration"] = sum(item1["extra_break_duration"] for item1 in grp5)
temp_dict["absent_days_by_hr"] = sum(item1["absent_days_by_hr"] for item1 in grp6)
temp_dict["total_hours"] = sum(item["total_hours"] for item in grp7) - (
temp_dict["leave"] + temp_dict["mission_by_days"])
temp_dict["total_hours"] = temp_dict["absent"] - temp_dict["absent_days_by_hr"]
temp_dict["dummy_field"] = sum(item["dummy_field"] for item in grp13)
temp_dict["total_amount"] = sum(item["total_amount"] for item in grp8) / len(list(grp9))
temp_dict["amount_per_hour"] = sum(item["amount_per_hour"] for item in grp10) / len(list(grp11))