From 5f9a96dbf45d33db125bc880ac6d5d5fb925887e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Sun, 22 Dec 2024 20:57:42 +0800 Subject: [PATCH] =?UTF-8?q?ljm=20=E4=BF=AE=E6=94=B9=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_wechat/models/hr_attendance_detail.py | 39 ++++---------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/yuthon_wechat/models/hr_attendance_detail.py b/yuthon_wechat/models/hr_attendance_detail.py index bfb9b4694..72c2e06fe 100644 --- a/yuthon_wechat/models/hr_attendance_detail.py +++ b/yuthon_wechat/models/hr_attendance_detail.py @@ -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]