diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index e25a25d9d..3b34634c0 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -44,7 +44,7 @@ class HrAttendance(models.Model): ('seven', '日')], string='星期', compute='_compute_week', store=True) abnormal = fields.Integer(string="异常计算") shift_id = fields.Many2one('planning.slot', string="班次", store=True) - shift_name = fields.Char(string="班次", related="shift_id.template_id.planning_name", store=True) + shift_name = fields.Char(string="班次", store=True) noon_duty = fields.Datetime(string="中值") night_duty = fields.Datetime(string="晚值") is_approval = fields.Boolean(string="是否审批修正", default=False) @@ -114,6 +114,8 @@ 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), diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 9ecaac926..21e87dc3a 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -25,7 +25,7 @@ - + @@ -68,7 +68,7 @@ - +