diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py index 46d6af2b1..d16289b27 100644 --- a/yuthon_hr_attendance/controllers/applet_attendance.py +++ b/yuthon_hr_attendance/controllers/applet_attendance.py @@ -299,7 +299,7 @@ class AppletAttendance(Controller): check_out_str = check_out.strftime('%H:%M:%S') if check_out else ' ' has_leave_batch_workflow = False if hasattr(attendance_id, 'workflow_id') and attendance_id.workflow_id: - if attendance_id.workflow_id.res_model in ['hr.leave.batch', 'go.approval']: + if attendance_id.workflow_id.res_model in ['hr.leave.batch', 'go.approval', 'card.approval']: has_leave_batch_workflow = True check_in_html = ( diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 93a0a6c74..9bdda7add 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -1036,7 +1036,10 @@ class YuthonVacationReports(models.Model): if att.is_abnormal: is_abnormal += 1 # 5. 计算应到天数(适配外派) - contract = employee.contract_id + # 取员工最早的合同(含已中止),从最早入职时间开始统计应到天数 + contract = self.env['hr.contract'].search([ + ('employee_id', '=', employee.id), + ], order='date_start asc, id asc', limit=1) if is_outside: if exp_has_return and exp_end_return: work_days = rec._create_leave_record(employee, exp_end_return + timedelta(days=1), month_end)