diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py index 1ba981ec6..cf8649f8a 100644 --- a/yuthon_hr_attendance/models/go_approval.py +++ b/yuthon_hr_attendance/models/go_approval.py @@ -322,6 +322,13 @@ class GoApprovals(models.Model): ('vacation_date', '=', month_first) ], limit=1) + if not reports_id: + reports_id = self.env['yuthon.vacation.reports'].create({ + 'employee_id': self.users_id.employee_ids.id, + 'vacation_date': month_first, + }) + reports_id.vacation_state = 'not_sent' + # 如果当月考勤确认单已确认,则将数据加到下个月的确认单 if reports_id and reports_id.vacation_state == 'confirmed': next_month_first = month_first + relativedelta(months=1) diff --git a/yuthon_hr_attendance/models/overtime_approval.py b/yuthon_hr_attendance/models/overtime_approval.py index 7606e2b07..1e5bb697c 100644 --- a/yuthon_hr_attendance/models/overtime_approval.py +++ b/yuthon_hr_attendance/models/overtime_approval.py @@ -423,7 +423,7 @@ class OvertimeApprovals(models.Model): self.allocation_id.sudo().action_validate() # 创建日志 if self.start_time: - start_date = fields.Datetime.from_string(self.start_time).date() + start_date = fields.Datetime.from_string(self.start_time + timedelta(hours=8)).date() vacation_date = start_date.replace(day=1) reports_id = self.env['yuthon.vacation.reports'].search([ ('employee_id', '=', employee_id.id),