From d849e17fdb042ac564a36b34f5fed2975086a5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Thu, 21 Nov 2024 15:35:44 +0800 Subject: [PATCH] pengyuthon wechat --- yuthon_holiday/__manifest__.py | 2 +- yuthon_holiday/security/ir.model.access.csv | 5 +++-- yuthon_notice/models/yuthon_confirm_users.py | 21 +++++++++++++------- yuthon_notice/models/yuthon_notice.py | 3 +-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/yuthon_holiday/__manifest__.py b/yuthon_holiday/__manifest__.py index f5f32b1b7..12b2c373d 100644 --- a/yuthon_holiday/__manifest__.py +++ b/yuthon_holiday/__manifest__.py @@ -7,7 +7,7 @@ 'license': 'LGPL-3', 'data': [ 'security/ir.model.access.csv', - 'security/yuthon_holiday_security.xml', + # 'security/yuthon_holiday_security.xml', 'views/inherit_hr_type_views.xml', 'views/inherit_hr_leave_allocation_views.xml', 'views/inherit_hr_leave_accrual_plan_views.xml', diff --git a/yuthon_holiday/security/ir.model.access.csv b/yuthon_holiday/security/ir.model.access.csv index d3e6ee678..74e00e239 100644 --- a/yuthon_holiday/security/ir.model.access.csv +++ b/yuthon_holiday/security/ir.model.access.csv @@ -1,3 +1,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_hr_leave_batch,hr.leave.batch,model_hr_leave_batch,,1,1,1,1 -access_hr_leave_line,hr.leave.line,model_hr_leave_line,,1,1,1,1 \ No newline at end of file +access_hr_leave_batch,hr_leave_batch,model_hr_leave_batch,base.group_user,1,1,1,1 +access_hr_leave_line,hr_leave_line,model_hr_leave_line,base.group_user,1,1,1 +access_hr_leave_type,hr_leave_type,model_hr_leave_type,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_notice/models/yuthon_confirm_users.py b/yuthon_notice/models/yuthon_confirm_users.py index 01bd7c83c..cfbc7a769 100644 --- a/yuthon_notice/models/yuthon_confirm_users.py +++ b/yuthon_notice/models/yuthon_confirm_users.py @@ -16,19 +16,26 @@ class YuthonConfirmUsers(models.Model): def sync_confirm_users_notices(self): menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的通知公告')]) for record in self.search([('state', '=', 'no')]): - str = 'https://www.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=yuthon.notice&view_type=form'.format( + str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=yuthon.notice&view_type=form'.format( record.notice_id.id, menu_id.id, menu_id.action.id) - data = "您有待确认的通知公告请确认\n" + "{}".format(str, self.name) - record.sudo().env["wecom.apps"].sync_send_message(record.employee_id.wecom_userid, data) + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', + user_id=record.employee_id.wecom_userid, + title="通知公告", + description="您有待确认的通知公告请尽快确认", + url=str, btntxt="详细信息") def reminders_notice(self): for rem in self: if rem.state == 'yes': raise UserError('已确认不可催办') - confirm_noice_ids = self.env["yuthon.confirm.users"].browse(self._context.get('active_ids', self._context.get('active_id'))) + confirm_noice_ids = self.env["yuthon.confirm.users"].browse( + self._context.get('active_ids', self._context.get('active_id'))) for rec in confirm_noice_ids: menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的通知公告')]) - str = 'https://www.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=yuthon.notice&view_type=form'.format( + str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=yuthon.notice&view_type=form'.format( rec.notice_id.id, menu_id.id, menu_id.action.id) - data = "您有待确认的通知公告请尽快确认\n" + "{}".format(str, rec.notice_id.name) - rec.sudo().env["wecom.apps"].sync_send_message(rec.employee_id.wecom_userid, data) + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', + user_id=rec.employee_id.wecom_userid, + title="通知公告(催办)", + description="您有待确认的通知公告请尽快确认", + url=str, btntxt="详细信息") diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index 4a78f20f3..9c6a5c8af 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -77,8 +77,7 @@ class YuthonNotice(models.Model): 'notice_name': self.name, 'state': 'no', }) - self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', - user_id=we_id, + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id, title="通知公告", description="您有新的通知公告请及时确认", url=str, btntxt="详细信息")