diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py
index 2b79efb9d..02e432691 100644
--- a/yuthon_will_task/models/yuthon_will_task.py
+++ b/yuthon_will_task/models/yuthon_will_task.py
@@ -26,10 +26,16 @@ class YuthonWillTask(models.Model):
users_ids = fields.Many2many('res.users', string='用户', store=True, index=True)
user_role_ids = fields.Many2many('soong.user.role', string='角色', store=True, index=True)
task_time_ids = fields.Many2many('yuthon.task.time', string='提醒')
- start_time = fields.Datetime(string='开始时间', default=fields.Datetime.now)
- end_time = fields.Datetime(string='结束时间', default=lambda self: datetime.combine(datetime.now().date(), time(11, 0, 0)))
+ start_time = fields.Datetime(string='开始时间',default=lambda self: datetime.combine(datetime.now().date(), time(1, 0, 0)))
+ end_time = fields.Datetime(string='结束时间',default=lambda self: datetime.combine(datetime.now().date(), time(11, 0, 0)))
task_state = fields.Selection([('will', '待办'), ('done', '已办'), ('cancel', '取消')], default='will', string='状态', store=True)
+ @api.constrains('start_time', 'end_time')
+ def _check_start_end_time(self):
+ for record in self:
+ if record.start_time and record.end_time and record.start_time > record.end_time:
+ raise models.ValidationError("开始时间不能大于结束时间!")
+
@api.onchange('employee_ids')
def _onchange_employee_ids(self):
user_ids = []
diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml
index c47518f9f..8fdf0c81d 100644
--- a/yuthon_will_task/views/yuthon_will_task_views.xml
+++ b/yuthon_will_task/views/yuthon_will_task_views.xml
@@ -12,6 +12,7 @@
decoration-success="priority == 'important'">
+
@@ -94,6 +95,7 @@
decoration-success="priority == 'important'" create="false" edit="false" js_class="custom_task_tree_button">
+
@@ -180,7 +182,6 @@
日程管理
yuthon.will.task
tree,calendar,form
- [('users_ids', 'in', [uid])]
{'search_default_next_seven_days': 1}