From 302a30e2c8389fb171021bf51fa28139d109d229 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Thu, 18 Dec 2025 15:47:25 +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 | 14 +++++---------
yuthon_holiday/views/hr_leave_batch.xml | 2 +-
yuthon_will_task/views/yuthon_dates_task_views.xml | 2 +-
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py
index 1be16707a..b1d54cfda 100644
--- a/yuthon_holiday/models/inherit_hr_leave.py
+++ b/yuthon_holiday/models/inherit_hr_leave.py
@@ -229,6 +229,7 @@ class HrLeave(models.Model):
else:
hours = 0.0
holiday.number_of_hours = hours
+ holiday.leave_hours = hours
if holiday.holiday_status_id.type_of_work == "0":
if holiday.request_hour_from and holiday.request_hour_to:
start_hour = float(holiday.request_hour_from)
@@ -236,13 +237,17 @@ class HrLeave(models.Model):
if start_hour < 12 and end_hour > 12:
hour = end_hour - start_hour - 1
holiday.number_of_hours = hour
+ holiday.leave_hours = hour
elif start_hour == 9 and end_hour == 12:
holiday.number_of_hours = 4
+ holiday.leave_hours = 4
else:
hour = end_hour - start_hour
holiday.number_of_hours = hour
+ holiday.leave_hours = hour
else:
holiday.number_of_hours = 0
+ holiday.leave_hours = 0
# 按天请假
days = holiday.batch_id._compute_duration_day(holiday.holiday_status_id, holiday.request_date_from , holiday.request_date_to)
@@ -686,7 +691,6 @@ class HolidaysRequestBatch(models.Model):
total_days = 0
first_hour_leave = self.hour_leave_ids[0] if self.hour_leave_ids else None
holiday_status_names = []
- # 处理leave_ids:收集假期类型、日期和天数
for leave in self.leave_ids:
# 收集假期类型名称(去重)
if leave.holiday_status_id and leave.holiday_status_id.name:
@@ -700,10 +704,8 @@ class HolidaysRequestBatch(models.Model):
if leave.request_date_to:
all_dates.append(leave.request_date_to)
- # 累加天数
total_days += leave.number_of_days_display if hasattr(leave, 'number_of_days_display') else 0
- # 处理hour_leave_ids:收集日期
for line in self.hour_leave_ids:
if line.request_date_from:
all_dates.append(line.request_date_from)
@@ -721,17 +723,11 @@ class HolidaysRequestBatch(models.Model):
# 生成名称:员工名 + 假期类型 + 日期范围 + 天数/小时
if self.employee_id:
name_parts = [f"{self.employee_id.name}的"]
-
- # 拼接假期类型
if holiday_status_names:
name_parts.append(','.join(holiday_status_names))
-
- # 拼接日期范围
if self.start_date and self.end_date:
date_part = f"{self.start_date.strftime('%Y-%m-%d')}~{self.end_date.strftime('%Y-%m-%d')}"
name_parts.append(date_part)
-
- # 拼接整请假天数
if self.leave_ids:
name_parts.append(f"共计{int(total_days)}天")
diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml
index 569761cc2..64ebe943e 100644
--- a/yuthon_holiday/views/hr_leave_batch.xml
+++ b/yuthon_holiday/views/hr_leave_batch.xml
@@ -70,6 +70,7 @@
'default_employee_id': employee_id,
}" string=" " style="width: 150%;">
+
@@ -116,7 +117,6 @@
-
diff --git a/yuthon_will_task/views/yuthon_dates_task_views.xml b/yuthon_will_task/views/yuthon_dates_task_views.xml
index fe55a105a..7a3c17076 100644
--- a/yuthon_will_task/views/yuthon_dates_task_views.xml
+++ b/yuthon_will_task/views/yuthon_dates_task_views.xml
@@ -6,7 +6,7 @@