日程管理
This commit is contained in:
@@ -67,7 +67,7 @@ class YuthonWillTask(models.Model):
|
||||
document_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
address = fields.Char(string='地点')
|
||||
start_date = fields.Date(string='开始日期', default=fields.Date.today)
|
||||
task_time = fields.Char(string='任务时间')
|
||||
task_time = fields.Char(string='任务时间', compute='_compute_task_time', store=True)
|
||||
is_this_company = fields.Boolean(string='本公司', default=True)
|
||||
task_state = fields.Selection([('will', '待办'), ('done', '已办'), ('cancel', '取消')], default='will', string='状态', store=True)
|
||||
|
||||
@@ -123,10 +123,10 @@ class YuthonWillTask(models.Model):
|
||||
will_ids = self.env["yuthon.will.task"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in will_ids:
|
||||
record._check_task_time()
|
||||
record._compute_task_time()
|
||||
|
||||
@api.constrains('start_date', 'request_hour_from', 'request_hour_to', 'task_type', 'room_booking_id')
|
||||
def _check_task_time(self):
|
||||
@api.depends('start_date', 'task_week', 'request_hour_from', 'task_type', 'room_booking_id', 'room_booking_id.stop_datetime')
|
||||
def _compute_task_time(self):
|
||||
for record in self:
|
||||
date_str = ""
|
||||
if record.start_date:
|
||||
@@ -158,8 +158,7 @@ class YuthonWillTask(models.Model):
|
||||
'23': '23:00', '23.25': '23:15', '23.5': '23:30', '23.75': '23:45'
|
||||
}
|
||||
from_time = hour_mapping.get(record.request_hour_from, "")
|
||||
to_time = hour_mapping.get(record.request_hour_to, "")
|
||||
if date_str and from_time and to_time:
|
||||
if date_str and from_time:
|
||||
base_time = f"{date_str} {record.task_week} {from_time}"
|
||||
# 会议类型:拼接会议室预订的结束时间
|
||||
if record.task_type == 'meet' and record.room_booking_id and record.room_booking_id.stop_datetime:
|
||||
|
||||
Reference in New Issue
Block a user