From 0ac2afe36309e0b2547804c8d66b29b982e91afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 22 Sep 2025 08:45:05 +0800 Subject: [PATCH] 1 --- yuthon_hr_attendance/models/hr_attendance.py | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 47341ea8a..99004f5e2 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -173,24 +173,24 @@ class HrAttendance(models.Model): ('id', '!=', attendance.id), ], order='check_in desc', limit=1) - if last_attendance_before_check_in and last_attendance_before_check_in.check_out and last_attendance_before_check_in.check_out > attendance.check_in: - raise exceptions.ValidationError(_( - "Cannot create new attendance record for %(empl_name)s, the employee was already checked in on %(datetime)s", - empl_name=attendance.employee_id.name, - datetime=format_datetime(self.env, attendance.check_in, dt_format=False) - )) - if attendance.check_out: - last_attendance_before_check_out = self.env['hr.attendance'].search([ - ('employee_id', '=', attendance.employee_id.id), - ('check_in', '<', attendance.check_out), - ('id', '!=', attendance.id), - ], order='check_in desc', limit=1) - if last_attendance_before_check_out and last_attendance_before_check_in != last_attendance_before_check_out: - raise exceptions.ValidationError(_( - "Cannot create new attendance record for %(empl_name)s, the employee was already checked in on %(datetime)s", - empl_name=attendance.employee_id.name, - datetime=format_datetime(self.env, last_attendance_before_check_out.check_in, dt_format=False) - )) + # if last_attendance_before_check_in and last_attendance_before_check_in.check_out and last_attendance_before_check_in.check_out > attendance.check_in: + # raise exceptions.ValidationError(_( + # "Cannot create new attendance record for %(empl_name)s, the employee was already checked in on %(datetime)s", + # empl_name=attendance.employee_id.name, + # datetime=format_datetime(self.env, attendance.check_in, dt_format=False) + # )) + # if attendance.check_out: + # last_attendance_before_check_out = self.env['hr.attendance'].search([ + # ('employee_id', '=', attendance.employee_id.id), + # ('check_in', '<', attendance.check_out), + # ('id', '!=', attendance.id), + # ], order='check_in desc', limit=1) + # if last_attendance_before_check_out and last_attendance_before_check_in != last_attendance_before_check_out: + # raise exceptions.ValidationError(_( + # "Cannot create new attendance record for %(empl_name)s, the employee was already checked in on %(datetime)s", + # empl_name=attendance.employee_id.name, + # datetime=format_datetime(self.env, last_attendance_before_check_out.check_in, dt_format=False) + # )) #考勤异常提醒 def attendance_abnormal_remind(self):