添加功能
This commit is contained in:
@@ -151,7 +151,6 @@ class YuthonNotice(models.Model):
|
||||
if self.is_change_notice:
|
||||
conf_old = self.env['yuthon.confirm.users'].search([('notice_id', '=', self.id), ('employee_id', 'in', self.users_ids.ids)])
|
||||
for user_id in self.users_ids:
|
||||
url = f'http://oa.thtzjt.com/webh5#/notice?id={self.id}'
|
||||
if conf_old:
|
||||
for co in conf_old:
|
||||
co.write({'state': 'no'})
|
||||
@@ -163,10 +162,16 @@ class YuthonNotice(models.Model):
|
||||
'notice_name': self.name,
|
||||
'state': 'no',
|
||||
})
|
||||
we_id = self.env['hr.employee'].search([('id', '=', user_id.employee_ids.id)]).wecom_userid
|
||||
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id, title="通知公告",
|
||||
description=self.name + '发布人:' + self.users_id.name,
|
||||
url=url, btntxt="详细信息")
|
||||
we_id_list = []
|
||||
for user_id in self.users_ids:
|
||||
employee = user_id.employee_ids
|
||||
if employee and employee.wecom_userid:
|
||||
we_id_list.append(employee.wecom_userid)
|
||||
touser = "|".join(we_id_list) if we_id_list else ""
|
||||
url = f'http://oa.thtzjt.com/webh5#/notice?id={self.id}'
|
||||
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', touser=touser, title="通知公告",
|
||||
description=self.name + '发布人:' + self.users_id.name,
|
||||
url=url, btntxt="详细信息")
|
||||
self.write({"notice_state": 'yes'})
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
|
||||
@@ -96,7 +96,7 @@ class WeComApps(models.Model):
|
||||
return True, result_data
|
||||
return False, result_data
|
||||
|
||||
def sync_send_message_textcard(self, content_item='', category='default', user_id=None, title="", description="", url="", btntxt="详情"):
|
||||
def sync_send_message_textcard(self, content_item='', touser='', category='default', user_id=None, title="", description="", url="", btntxt="详情"):
|
||||
"""
|
||||
touser 否 成员ID列表(消息接收者,多个接收者用‘|’分隔,最多支持1000个)。特殊情况:指定为@all,则向关注该企业应用的全部成员发送
|
||||
toparty 否 部门ID列表,多个接收者用‘|’分隔,最多支持100个。当touser为@all时忽略本参数
|
||||
@@ -161,7 +161,7 @@ class WeComApps(models.Model):
|
||||
}
|
||||
else:
|
||||
data = {
|
||||
'touser': user_id,
|
||||
'touser': touser,
|
||||
'msgtype': 'textcard',
|
||||
'agentid': wecom_app.agent_id,
|
||||
"textcard": {
|
||||
|
||||
Reference in New Issue
Block a user