diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index ab27d4545..cbd6cbb84 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -60,6 +60,7 @@ class HrAttendance(models.Model): is_workflow = fields.Boolean(string="是否是流程", default=False) workflow_id = fields.Many2one('soong.workflow.record', string="流程") is_month = fields.Boolean(string="是否为本月数据", compute='_compute_month_status', store=True) + is_late_allowed = fields.Boolean(string="是否允许迟到", default=False) is_last_month = fields.Boolean(string="是否为上月数据", compute='_compute_month_status', store=True) correct_result = fields.Text(string="修正原因") diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py index 38cf342b5..858b0cb72 100644 --- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py +++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py @@ -344,7 +344,7 @@ class HrAttendanceDetail(models.Model): else: sch_check_out_time = sch_check_out_time - timedelta(hours=1) - is_early_card, is_late_card, is_abnormal, is_warning, absenteeism_card, is_no_card = self.state_judgment(employee, check_in_time, check_out_time, sch_check_in_time, sch_check_out_time, current_data, is_manual) + is_early_card, is_late_card, is_abnormal, is_warning, absenteeism_card, is_no_card = self.state_judgment(employee, check_in_time, check_out_time, sch_check_in_time, sch_check_out_time, current_data, is_manual, attendance) is_expatriation = self.env['expatriation.approval'].search([('work_end', '=', True),('expatriates_ids', 'in', [employee.id]), ('is_effect', '=', False)]) if not self._process_shift_days(current_data) and template.role_id.name == '集团行政': start_datetime = datetime.combine(current_data, datetime.min.time()) @@ -475,7 +475,7 @@ class HrAttendanceDetail(models.Model): minutes = int((hour_float - hours) * 60) return datetime.combine(base_date, datetime.min.time()) + timedelta(hours=hours, minutes=minutes) - def state_judgment(self, employee, check_in, check_out, start_datetime, end_datetime, current_data, is_manual): + def state_judgment(self, employee, check_in, check_out, start_datetime, end_datetime, current_data, is_manual, attendance): """ 判断打卡状态 :param check_in: 签到时间 @@ -555,8 +555,10 @@ class HrAttendanceDetail(models.Model): if late_delta > 2: is_late_card = True else: - # 迟到超过10分钟 并且也算迟扣允许迟到次数 到 - employee.late_allowed -= 1 + if attendance.is_late_allowed == False: + # 迟到超过10分钟 并且也算迟扣允许迟到次数 到 + employee.late_allowed -= 1 + attendance.is_late_allowed = True if late_delta > 10: is_late_card = True diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 3f65dd4c5..ea5bf3d0d 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -102,6 +102,7 @@ +