![]() |
2 лет назад | |
---|---|---|
.. | ||
api | 2 лет назад | |
controllers | 2 лет назад | |
data | 2 лет назад | |
i18n | 2 лет назад | |
models | 2 лет назад | |
security | 2 лет назад | |
static | 2 лет назад | |
tools | 2 лет назад | |
views | 2 лет назад | |
__init__.py | 2 лет назад | |
__manifest__.py | 2 лет назад | |
readme.md | 2 лет назад |
# 初始化API 模型对象
# 参数为:公司对象,secret字段的名称,以及令牌类型
wxapi = self.env["wecom.service_api"].InitServiceApi(
company, "contacts_secret", "contacts"
)
# "DEPARTMENT_LIST"是请求的API类型,通过API类型生成 调用企业微信的API URL
response = wxapi.httpCall(
self.env["wecom.service_api_list"].get_server_api_call(
"DEPARTMENT_LIST"
),
{
"id": str(company.contacts_sync_hr_department_id),
},
)
from odoo.addons.oec_im_wecom_api.api.wecom_abstract_api import ApiException
try:
....
....
....
except ApiException as e:
# 弹框显示异常
return self.env["wecom.tools"].ApiExceptionDialog(ex)