From da67c53b2fe604fb300d2cdec511da2f0e208148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Tue, 23 Sep 2025 20:30:34 +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 --- yuthon_hr_attendance/models/hr_attendance.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index c8db45156..e38533bc6 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -460,9 +460,7 @@ class HrAttendance(models.Model): end_date = fields.Date.from_string('2025-09-23') # 获取所有员工 - existing_employees = self.env['hr.employee'].search([ - ('id', 'in', self.search([]).mapped('employee_id.id')) # 仅包含有过记录的员工 - ]) + existing_employees = self.env['hr.employee'].search([('name', 'not in', ['郭一鸣','罗白义', '罗琼芳', '肖琼', '李芳萍', '钱康'])]) if not existing_employees: return @@ -503,7 +501,8 @@ class HrAttendance(models.Model): if key not in existing_map: records_to_create.append({ 'employee_id': employee.id, - 'check_in': date_str, # 设置为当天 + 'current_data': date_str, + 'check_in': False, 'check_out': False, 'is_no_card': False, 'is_abnormal': False @@ -512,7 +511,6 @@ class HrAttendance(models.Model): # 批量创建记录(效率更高) if records_to_create: self.create(records_to_create) - self.env.cr.commit() # 可选:立即提交事务 def button_source(self):