diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py index 93892bd7f..64e12af08 100644 --- a/yuthon_will_task/models/yuthon_will_task.py +++ b/yuthon_will_task/models/yuthon_will_task.py @@ -82,7 +82,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='任务时间', compute='_compute_task_time') + task_time = fields.Char(string='任务时间') is_this_company = fields.Boolean(string='本公司', default=True) task_state = fields.Selection([('will', '待办'), ('done', '已办'), ('cancel', '取消')], default='will', string='状态', store=True) @@ -116,8 +116,8 @@ class YuthonWillTask(models.Model): if record.start_date: record.task_week = weekdays[record.start_date.weekday()] - @api.depends('start_date', 'request_hour_from', 'request_hour_to') - def _compute_task_time(self): + @api.constrains('start_date', 'request_hour_from', 'request_hour_to') + def _check_task_time(self): for record in self: date_str = "" if record.start_date: @@ -151,7 +151,7 @@ class YuthonWillTask(models.Model): 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: - record.task_time = f"{date_str} {from_time}" + record.task_time = f"{date_str} {record.task_week} {from_time}" else: record.task_time = "" diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml index 67a36d600..33f38eb73 100644 --- a/yuthon_will_task/views/yuthon_will_task_views.xml +++ b/yuthon_will_task/views/yuthon_will_task_views.xml @@ -73,7 +73,7 @@