From 446016a378a3fb3ffc5936db6fe1240a35a8eab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Wed, 1 Jan 2025 17:43:39 +0800 Subject: [PATCH] =?UTF-8?q?ljm=20=E4=BF=AE=E6=94=B9=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_will_task/models/yuthon_will_task.py | 9 +++++++-- yuthon_will_task/views/yuthon_will_task_views.xml | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py index d18e894ce..8db1ba5b3 100644 --- a/yuthon_will_task/models/yuthon_will_task.py +++ b/yuthon_will_task/models/yuthon_will_task.py @@ -28,6 +28,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))) state = fields.Selection([('will', '待办'), ('done', '已办'), ('cancel', '取消')], default='will', string='状态') + employee_id = fields.Many2one('hr.employee', string='司机') def read_number(self): return self.search_count([('state', '=', 'will'), ('user_ids', 'in', self.env.user.id)]) @@ -80,8 +81,13 @@ class YuthonWillTask(models.Model): if not employee_id.wecom_userid: raise UserError("请同步{}的企业微信".format(employee_id.name)) url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self._name, self.id) + data_name = "事项名称: " + self.task_content + '\n' + data_start_time = '开始时间:' + str(self.start_time + timedelta(hours=8)) + '\n' + data_user_ids = '参与人: ' + ', '.join(self.employee_ids.mapped('name')) + '\n' + data_employee_id = ('司机:' + self.employee_id.name)if self.employee_id.name else '' + data = data_name + data_start_time + data_user_ids + data_employee_id self.sudo().env["wecom.apps"].sync_send_message_textcard(category='task', user_id=employee_id.wecom_userid, - title="日程事项提醒", description="事项名称: " + self.task_content + '\t' + str(self.start_time), + title="日程事项提醒", description=data, url=url, btntxt="详细信息") for record in self: partner_ids = record.employee_ids.user_id.partner_id.ids @@ -100,7 +106,6 @@ class YuthonWillTask(models.Model): } def button_add_comment_cancel(self): - self.add_comment() for employee_id in self.employee_ids: if not employee_id.wecom_userid: raise UserError("请同步{}的企业微信".format(employee_id.name)) diff --git a/yuthon_will_task/views/yuthon_will_task_views.xml b/yuthon_will_task/views/yuthon_will_task_views.xml index 053c0f435..5a0636bdb 100644 --- a/yuthon_will_task/views/yuthon_will_task_views.xml +++ b/yuthon_will_task/views/yuthon_will_task_views.xml @@ -20,6 +20,7 @@ +