ljm 修改备份
This commit is contained in:
@@ -685,37 +685,14 @@ class HrAttendanceDetail(models.Model):
|
||||
checkin_time = attendance_detail_obj.checkin_time
|
||||
will_datetime_start = checkin_time.replace(hour=min_hour, minute=min_minute) - timedelta(hours=8)
|
||||
will_datetime_end = checkin_time.replace(hour=max_hour, minute=max_minute) - timedelta(hours=8)
|
||||
check_in = attendance_obj.check_in if attendance_obj.check_in else None
|
||||
check_out = attendance_obj.check_out if attendance_obj.check_out else None
|
||||
# 如果原记录有上班打卡时间 和 下班打卡时间
|
||||
checkin_time_list = [checkin_time]
|
||||
if check_in:
|
||||
checkin_time_list.append(check_in)
|
||||
if check_out:
|
||||
checkin_time_list.append(check_out)
|
||||
if len(checkin_time_list) > 1:
|
||||
# 最早 和 最晚 时间
|
||||
min_time = min(checkin_time_list)
|
||||
max_time = max(checkin_time_list)
|
||||
attendance_obj.sudo().write({
|
||||
"sch_check_in_time": will_datetime_start,
|
||||
"check_in": min_time,
|
||||
"is_late_card": min_time > will_datetime_start,
|
||||
|
||||
"sch_check_out_time": will_datetime_end,
|
||||
"check_out": max_time,
|
||||
"is_early_card": will_datetime_end > max_time,
|
||||
})
|
||||
return True
|
||||
else:
|
||||
# 既不是上班也不是下班,默认为上班打卡
|
||||
attendance_obj.sudo().write({
|
||||
"sch_check_in_time": will_datetime_start,
|
||||
"check_in": checkin_time,
|
||||
"is_late_card": checkin_time > will_datetime_start,
|
||||
"is_no_card": True,
|
||||
})
|
||||
return True
|
||||
# 既不是上班也不是下班,默认为上班打卡
|
||||
attendance_obj.sudo().write({
|
||||
"sch_check_in_time": will_datetime_start,
|
||||
"check_in": checkin_time,
|
||||
"is_late_card": checkin_time > will_datetime_start,
|
||||
"is_no_card": True,
|
||||
})
|
||||
return True
|
||||
else:
|
||||
# 多次打卡时间的集合
|
||||
checkin_time_list = [obj.checkin_time for obj in attendance_detail_obj]
|
||||
|
||||
Reference in New Issue
Block a user