diff --git a/yuthon_hr_attendance/data/attendance_time_data.xml b/yuthon_hr_attendance/data/attendance_time_data.xml index 3432f0d7d..e875e00a7 100644 --- a/yuthon_hr_attendance/data/attendance_time_data.xml +++ b/yuthon_hr_attendance/data/attendance_time_data.xml @@ -18,7 +18,7 @@ 定时任务:粮库上班打卡提醒 code - model.card_remind() + model.card_lc_remind_in() 1 @@ -31,12 +31,12 @@ 定时任务:粮储下班打卡提醒 code - model.card_remind() + model.card_lc_remind_out() 1 days - + -1 @@ -44,34 +44,7 @@ 定时任务:粮库值班上班打卡提醒 code - model.card_remind() - - - 1 - days - - -1 - - - - 定时任务:粮储值班下班打卡提醒 - - code - model.card_remind() - - - 1 - days - - -1 - - - - - 定时任务:工程部白班上班打卡提醒 - - code - model.card_remind() + model.card_lc_shift_remind_in() 1 @@ -80,11 +53,64 @@ -1 + + 定时任务:粮库值班打卡提醒 + + code + model.card_lc_shift_remind() + + + 1 + days + + -1 + + + + 定时任务:粮储值班下班打卡提醒 + + code + model.card_lc_shift_remind_out() + + + 1 + days + + -1 + + + + + 定时任务:工程部白班上班打卡提醒 + + code + model.gc_white_in_remind() + + + 1 + days + + -1 + + + + 定时任务:工程部白班值班打卡提醒 + + code + model.gc_white_shift_remind() + + + 1 + days + + -1 + + 定时任务:工程部白班下班打卡提醒 code - model.card_remind() + model.gc_white_out_remind() 1 @@ -97,7 +123,7 @@ 定时任务:工程部中值夜班上班打卡提醒 code - model.card_remind() + model.gc_night_remind_in() 1 @@ -106,16 +132,29 @@ -1 - - 定时任务:工程部中值夜班下班打卡提醒 + + 定时任务:工程部中值夜班值班打卡提醒 code - model.card_remind() + model.gc_night_remind_shift() 1 days - + + -1 + + + + 定时任务:工程部中值夜班下班打卡提醒 + + code + model.gc_night_remind_out() + + + 1 + days + -1 diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index f2838738c..5baa37205 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -298,6 +298,85 @@ class HrAttendance(models.Model): if user.end_datetime.date() == fields.date.today(): self.card_out_comment(user.resource_id.employee_id) + # 工程部 - 白班 白值 + def gc_white_in_remind(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '工程部'), ('template_id.planning_name', 'in', ['白班', '白班中午值班'])]) + for user in ba_up_users: + if user.start_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + def gc_white_shift_remind(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '工程部'), ('template_id.planning_name', '=', '白班中午值班')]) + for user in ba_up_users: + self.card_in_comment(user.resource_id.employee_id) + + def gc_white_out_remind(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '工程部'), ('template_id.planning_name', 'in', ['白班', '白班中午值班'])]) + for user in ba_up_users: + if user.end_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + # 工程部-中值夜 + def gc_night_remind_in(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '工程部'), ('template_id.planning_name', '=', '中值夜班')]) + for user in ba_up_users: + if user.start_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + def gc_night_remind_shift(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '工程部'), ('template_id.planning_name', '=', '中值夜班')]) + for user in ba_up_users: + self.card_in_comment(user.resource_id.employee_id) + + def gc_night_remind_out(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '工程部'), ('template_id.planning_name', '=', '中值夜班')]) + for user in ba_up_users: + if user.end_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + # 粮储-白班 + def card_lc_remind_in(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '联安粮储'), ('template_id.planning_name', '=', '粮库白班')]) + for user in ba_up_users: + if user.start_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + def card_lc_remind_out(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '联安粮库'), ('template_id.planning_name', '=', '粮库白班')]) + for user in ba_up_users: + if user.end_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + # 粮储-值班 + def card_lc_shift_remind_in(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '联安粮库'), ('template_id.planning_name', '=', '粮库值班')]) + for user in ba_up_users: + if user.start_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + def card_lc_shift_remind_time(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '联安粮库'), ('template_id.planning_name', '=', '粮库值班')]) + for user in ba_up_users: + self.card_in_comment(user.resource_id.employee_id) + + def card_lc_shift_remind_out(self): + ba_up_users = self.env['planning.slot'].search( + [('role_id.name', '=', '联安粮库'), ('template_id.planning_name', '=', '粮库值班')]) + for user in ba_up_users: + if user.end_datetime.date() == fields.date.today(): + self.card_in_comment(user.resource_id.employee_id) + + # def card_remind(self): # today = datetime.today() # tomorrow = today + timedelta(days=1)