From 9c9acaef0ec8b01ea2e963d0dd996e1d666f1a87 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Wed, 26 Jun 2024 18:44:31 +0800 Subject: [PATCH] =?UTF-8?q?ljm=20=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=20?= =?UTF-8?q?=E6=89=AB=E7=A0=81=E7=99=BB=E9=99=86=20=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/resource_calendar_leaves.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/yuthon_hr_attendance/models/resource_calendar_leaves.py b/yuthon_hr_attendance/models/resource_calendar_leaves.py index 59c77697f..8cc8cd126 100644 --- a/yuthon_hr_attendance/models/resource_calendar_leaves.py +++ b/yuthon_hr_attendance/models/resource_calendar_leaves.py @@ -16,6 +16,21 @@ class ResourceCalendar(models.Model): string="部门", domain="[('company_id', 'in', allowed_company_ids)]" ) + card_start_time = fields.Float(string="打卡开始时间") + card_end_time = fields.Float(string="打卡结束时间") + employee_ids = fields.One2many('hr.employee', 'user_id', string='打卡白名单') + elasticity_work_time = fields.Boolean(string="弹性上下班") + allow_late_early = fields.Boolean(string="允许迟到早退") + go_allow_late = fields.Float(string="上班允许迟到") + go_allow_early = fields.Float(string="下班允许早退") + allow_late_early_leave = fields.Boolean(string="允许早到早走, 晚到晚走") + leave_allow_early = fields.Float(string="最多早到早走") + leave_allow_late = fields.Float(string="最多晚到晚走") + + allow_late_early_work = fields.Boolean(string="允许下班晚走次日晚到") + work_late = fields.Float(string="下班晚走") + work_after = fields.Float(string="次日可晚到") + def get_baidu_holiday(self): """ @@ -77,16 +92,24 @@ class ResourceCalendar(models.Model): datetime.strptime(date, "%Y-%m-%d")] holidays_dic[holiday][1] = datetime.strptime(date, "%Y-%m-%d") holiday_list = [] + leave_list = [] for holiday, time in holidays_dic.items(): holiday_values = { 'holiday_type': holiday, 'calendar_start_time': time[0] - timedelta(hours=8), 'calendar_end_time': time[1].replace(hour=15, minute=59, second=59), } + leave_values = { + 'name': holiday, + 'date_from': time[0] - timedelta(hours=8), + 'date_to': time[1].replace(hour=15, minute=59, second=59), + } holiday_list.append((0, 0, holiday_values)) + leave_list.append((0, 0, leave_values)) self.calendar_holiday_ids.unlink() self.holiday_data_lines = holiday_list self.write({'calendar_holiday_ids': holiday_list}) + self.write({'global_leave_ids': leave_list}) class ResourceCalendarHolidaye(models.Model):