From 1f0d5a1a7ddf59b6af68c0de6fffa8ee6733ca4f Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Sun, 11 May 2025 20:06:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_holiday/models/inherit_hr_leave.py | 13 ++++++++++--- yuthon_hr_attendance/models/hr_attendance.py | 1 + yuthon_hr_attendance/views/hr_attendance_views.xml | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index de0041558..a4a36577b 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -64,7 +64,7 @@ class HrLeave(models.Model): leave_documents_ids = fields.Many2many(related='holiday_status_id.leave_documents_id', string="假期详情说明", readonly=True) details = fields.Text(string="假期流程说明") request_hour_from_real = fields.Selection([ - ('0', '00:00'), ('0.5', '00:30'), + ('0', '0:00'), ('0.5', '0:30'), ('1', '01:00'), ('1.5', '01:30'), ('2', '02:00'), ('2.5', '02:30'), ('3', '03:00'), ('3.5', '03:30'), @@ -97,7 +97,7 @@ class HrLeave(models.Model): # column2='attachment_id' # ) request_hour_from = fields.Selection([ - ('0', '00:00'), ('0.5', '00:30'), + ('0', '0:00'), ('0.5', '0:30'), ('1', '01:00'), ('1.5', '01:30'), ('2', '02:00'), ('2.5', '02:30'), ('3', '03:00'), ('3.5', '03:30'), @@ -231,7 +231,8 @@ class HrLeave(models.Model): elif current_date_str in shift_days_list: if not is_weekend: days += 1 - elif is_weekend: + else : + if is_weekend: days -= 1 current_date += timedelta(days=1) @@ -248,6 +249,12 @@ class HrLeave(models.Model): if not self.env.context.get('no_change_request_unit_hours'): super()._compute_request_unit_hours() + @api.constrains('number_of_hours_text') + def _check_number_of_hours_text(self): + if self.number_of_hours_text: + if self.number_of_hours_text == 0: + raise UserError('请假天数不能为0') + @api.constrains('date_from', 'date_to', 'employee_id') def _check_date(self): if self.env.context.get('leave_skip_date_check', False): diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index f29e23234..673dbf2de 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -28,6 +28,7 @@ class HrAttendance(models.Model): down_card_location = fields.Char(string="下班打卡地点") out_card_time = fields.Datetime(string="外出打卡时间") out_card_location = fields.Char(string="外出打卡地点") + department_id = fields.Many2one(related='employee_id.department_id', string="部门", store=True) work_hours = fields.Float(string="工作时长") current_data = fields.Date(string='打卡日期', tracking=True) week = fields.Selection([('one', '一'), ('two', '二'), ('three', '三'), diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 7d2d3d3cb..8087c2fdc 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -20,6 +20,7 @@ +