diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 66460d89e..414d47d62 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -124,15 +124,6 @@ class HrAttendance(models.Model): for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))): current_data = fields.Datetime.to_datetime(att.current_data) + timedelta(hours=8) self.env["hr.attendance.detail"].compute_attendance_detail(att.employee_id, current_data.date(), is_manual=True) - # if att.employee_id.company_id.name in ['集团本部', '天河粮储']: - # att.shift_name = '行政班次' - # planning_slots = self.env['planning.slot'].search([ - # ('employee_id', '=', att.employee_id.id), - # ('start_datetime', '=', att.current_data), - # ], limit=1) - # - # att.write({'shift_id': planning_slots.id}) - @api.depends('current_data') def _compute_month_status(self): @@ -1303,6 +1294,9 @@ class HrAttendance(models.Model): else: record.shift_name = '行政班次' + if record.is_expatriation: + record.shift_name = '外派' + if record.shift_name == "休息" and not is_holiday: record.is_week = is_weekend else: @@ -1320,6 +1314,7 @@ class HrAttendance(models.Model): if current_data > today: return record record.set_shift_name() + record.compute_attendance_ids() return record def write(self, vals): @@ -1328,6 +1323,7 @@ class HrAttendance(models.Model): if 'current_data' in vals or 'shift_id' in vals: self.set_shift_name() for record in self: + record.compute_attendance_ids() self._update_vacation_report(record) return result