!9615 Merge branch 'master' into dev_zhou

Merge pull request !9615 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-03-11 12:42:02 +00:00
committed by Gitee
2 changed files with 17 additions and 50 deletions
-31
View File
@@ -303,37 +303,6 @@ class RoomBooking(models.Model):
room_name=booking.room_id.name
))
@api.model_create_multi
def create(self, vals_list):
bookings = super().create(vals_list)
for booking in bookings:
# 提取参会人员ID列表
room_users_ids = []
if booking.room_users_ids:
room_users_ids = booking.room_users_ids.ids
# 提取当前经办人ID列表
self_users_ids = []
if booking.self_users_ids:
self_users_ids = booking.self_users_ids.ids
# 根据参会人员查找对应的员工
employee_records = self.env['hr.employee']
if room_users_ids:
employee_records = self.env['hr.employee'].search([('user_id', 'in', room_users_ids)])
self.env['yuthon.will.task'].create({
'name': booking.name,
'start_date': booking.start_datetime.date(),
'task_type': 'meet',
'priority': 'important',
'room_booking_id': booking.id,
'employee_ids': [(6, 0, employee_records.ids)],
'task_state': 'will',
'address': booking.room_id.name if booking.room_id else '',
'remarks': booking.meeting_data or '',
'users_ids': [(6, 0, room_users_ids)],
'self_users_ids': [(6, 0, self_users_ids)],
})
return bookings
# @api.model
# def create(self, vals):
#
+17 -19
View File
@@ -67,23 +67,21 @@ class InheritRoomBooking(models.Model):
elif nearest_minute == 45:
return f"{hour % 24}.75"
if new_record.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.stop_datetime)
task_id = self.env['yuthon.will.task'].sudo().create({
'name': new_record.name,
'employee_ids': [(6, 0, employee_list)],
'task_time_ids': [(6, 0, new_record.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,
'room_booking_id': new_record.id,
'task_type': 'meet',
'task_state': 'will',
})
task_id._onchange_employee_ids()
task_id._sync_dates_task()
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.stop_datetime)
task_id = self.env['yuthon.will.task'].sudo().create({
'name': new_record.name,
'employee_ids': [(6, 0, employee_list)],
'task_time_ids': [(6, 0, new_record.task_time_ids.ids)] if new_record.task_time_ids else [],
'start_date': start_date,
'request_hour_from': request_hour_from,
'request_hour_to': request_hour_to,
'address': new_record.room_id.name,
'room_booking_id': new_record.id,
'task_type': 'meet',
'task_state': 'will',
})
task_id._onchange_employee_ids()
return new_record