From d4026811f0eaaef4ba2e44bcb4f40c601b067d45 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: Wed, 24 Dec 2025 10:25:50 +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_will_task/models/yuthon_will_task.py | 8 ++++---- yuthon_will_task/views/yuthon_will_task_views.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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 @@