From 3be3b888a639ff2a57d616fb6ab7f339311c709c 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: Fri, 12 Dec 2025 10:26:39 +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
---
room/views/room_booking_views.xml | 12 ++++++------
yuthon_will_task/models/inherit_room_booking.py | 12 ++++++++++++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/room/views/room_booking_views.xml b/room/views/room_booking_views.xml
index 0cc429128..c48094b04 100644
--- a/room/views/room_booking_views.xml
+++ b/room/views/room_booking_views.xml
@@ -153,7 +153,7 @@
-
+
@@ -162,14 +162,14 @@
-
+
-
+
-
+
@@ -178,8 +178,8 @@
-
-
+
+
diff --git a/yuthon_will_task/models/inherit_room_booking.py b/yuthon_will_task/models/inherit_room_booking.py
index 0c67bd56c..acf57195f 100644
--- a/yuthon_will_task/models/inherit_room_booking.py
+++ b/yuthon_will_task/models/inherit_room_booking.py
@@ -13,15 +13,27 @@ class InheritRoomBooking(models.Model):
for user_id in new_record.room_users_ids:
if user_id.employee_id:
employee_list.append(user_id.employee_id.id)
+
+ def get_hour_selection(datetime_obj):
+ if not datetime_obj:
+ return None
+ hour = datetime_obj.hour
+ minute = datetime_obj.minute
+ return str(hour) if minute == 0 else f"{hour}.5"
+
if task_time_ids:
start_datetime = new_record.start_datetime
start_date = start_datetime.date()
+ request_hour_from = get_hour_selection(new_record.start_datetime)
+ request_hour_to = get_hour_selection(new_record.end_datetime)
self.env['yuthon.will.task'].sudo().create({
'name': new_record.name,
'users_ids': [(6, 0, new_record.room_users_ids.ids)],
'employee_ids': [(6, 0, employee_list)],
'task_time_ids': [(6, 0, task_time_ids.ids)],
'start_date': start_date,
+ 'request_hour_from': request_hour_from,
+ 'request_hour_to': request_hour_to,
'address' : new_record.room_id.name,
'task_state': 'will',
})