From 0349c369e94498c2d25ef7bc18980f1e6322d040 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 13 Aug 2025 16:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/hr_attendance_detail_wechat.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 7c518f37a..86a6afa44 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -113,19 +113,13 @@ class HrAttendanceDetail(models.Model): """同步打卡记录到hr.attendance 更新上下班打卡时间 """ checkin_date = fields.Date.from_string(record.checkin_time) attendance = self.env['hr.attendance'].search([ - ('employee_id', '=', record.employee_id.id), + ('employee_id.name', '=', '叶华锋'), ('current_data', '=', checkin_date) ], limit=1) if attendance: if not attendance.check_in: attendance.check_in = record.checkin_time - elif not attendance.check_out: - attendance.check_out = record.checkin_time - existing_checkout = fields.Datetime.from_string(attendance.check_out) - new_checkout = fields.Datetime.from_string(record.checkin_time) - # 只在新打卡时间更晚的情况下更新 - if new_checkout > existing_checkout: - attendance.check_out = record.checkin_time + attendance.check_out = record.checkin_time - timedelta(hours=8) # 传参按一个人打卡一次传参