@@ -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='任务时间')
|
||||
task_time = fields.Char(string='任务时间', compute='_compute_task_time')
|
||||
is_this_company = fields.Boolean(string='本公司', default=True)
|
||||
task_state = fields.Selection([('will', '待办'), ('done', '已办'), ('cancel', '取消')], default='will', string='状态', store=True)
|
||||
|
||||
@@ -106,8 +106,18 @@ class YuthonWillTask(models.Model):
|
||||
store=True, default=lambda self: [(6, 0, [self.env.user.id])]
|
||||
)
|
||||
|
||||
@api.constrains('start_date', 'request_hour_from', 'request_hour_to')
|
||||
def _check_task_time(self):
|
||||
employee_id = fields.Many2one('hr.employee', string="经办人", default=lambda self: self.env.user.employee_id)
|
||||
task_week = fields.Char(string="周", readonly=True, compute='_compute_task_week')
|
||||
|
||||
@api.depends('start_date')
|
||||
def _compute_task_week(self):
|
||||
weekdays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
||||
for record in self:
|
||||
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):
|
||||
for record in self:
|
||||
date_str = ""
|
||||
if record.start_date:
|
||||
|
||||
Reference in New Issue
Block a user