From 8347e30709cff32e5ea4e1461abf60e1951ed751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Tue, 26 Nov 2024 09:59:30 +0800 Subject: [PATCH] pengyuthon wechat --- yuthon_notice/models/yuthon_notice.py | 2 +- yuthon_will_task/models/yuthon_will_task.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index b12213bd8..8fdc8d2d6 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -20,7 +20,7 @@ class YuthonNotice(models.Model): start_date = fields.Date(string="生效日期", default=fields.Date.today()) end_date = fields.Date(string="终止日期") sequence = fields.Integer(string="顺序", default=1, compute='_compute_sequence') - employee_ids = fields.Many2many('hr.employee', string="人员范围") + employee_ids = fields.Many2many('hr.employee', string="人员范围", default=lambda self: self.env.user.employee_id) notice_state = fields.Selection([('no', '未发布'), ('yes', '已发布'), ('stop', '已终止')], default='no', string="公告状态") notice_documents_ids = fields.Many2many('ir.attachment', string="附件") diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py index 9831180c4..88db11bc7 100644 --- a/yuthon_will_task/models/yuthon_will_task.py +++ b/yuthon_will_task/models/yuthon_will_task.py @@ -21,6 +21,7 @@ class YuthonWillTask(models.Model): start_time = fields.Datetime(string='开始时间', default=fields.Date.today()) end_time = fields.Datetime(string='结束时间', default=lambda self: datetime.combine(datetime.now().date(), time(11, 0, 0))) weed = fields.Char(string='星期', compute='_compute_weed') + def will_task_time(self): tasks = self.env['yuthon.will.task'].search([]) for task in tasks: @@ -29,7 +30,7 @@ class YuthonWillTask(models.Model): duration = self._compute_duration(task_time) if time_difference <= duration and time_difference >= timedelta(seconds=0): task.add_comment() - break # + break def _compute_duration(self, task_time): if task_time.task_unit == 'min':