Skip to content

Commit

Permalink
在设置页面 添加更新自建应用的功能按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbow-studio-solution committed Jan 27, 2022
1 parent d1958ff commit c6e6c71
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 438 deletions.
1 change: 1 addition & 0 deletions wecom_api/models/wecom_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def generate_parameters_by_code(self, code):
# ————————————————————————————————————
# 应用信息
# ————————————————————————————————————

def get_app_info(self):
"""
获取企业应用信息
Expand Down
453 changes: 39 additions & 414 deletions wecom_auth_oauth/i18n/zh_CN.po

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions wecom_auth_oauth/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ def generate_parameters(self):
# else:
record.auth_app_id.with_context(code=code).generate_parameters()
super(ResConfigSettings, self).generate_parameters()

def get_app_info(self):
"""
获取应用信息
:return:
"""
for record in self:
record.auth_app_id.get_app_info()
super(ResConfigSettings, self).get_app_info()
1 change: 1 addition & 0 deletions wecom_auth_oauth/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<div class="mt8">
<field name="auth_app_id" class="w-100" widget="selection" domain="['&amp;',('type_code', 'like', '%auth%'),('company_id', '=', company_id)]"/>
</div>
<button class="btn btn-primary" name="get_app_info" string="Get application info" type="object" icon="fa-cloud-download" attrs="{'invisible': [('auth_app_id','=',False)]}"/>
</div>
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions wecom_base/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,10 @@ def open_wecom_settings(self):
action["target"] = "new"

return action

def get_app_info(self):
"""
获取企业应用信息
:param agentid:
:return:
"""
9 changes: 7 additions & 2 deletions wecom_hrm/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-27 04:54+0000\n"
"PO-Revision-Date: 2022-01-27 12:55+0800\n"
"POT-Creation-Date: 2022-01-27 09:16+0000\n"
"PO-Revision-Date: 2022-01-27 17:17+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
Expand Down Expand Up @@ -373,6 +373,11 @@ msgstr ""
"部门的排序值,默认为0。数量必须与部门相同,值越大,排序前部就越多。值范围为"
"[0,2 ^ 32)"

#. module: wecom_hrm
#: model:ir.model.constraint,message:wecom_hrm.constraint_wecom_contacts_block_userid_company_uniq
msgid "The user ID of each company must be unique!"
msgstr "每个公司的用户id必须是唯一的!"

#. module: wecom_hrm
#: model_terms:ir.ui.view,arch_db:wecom_hrm.view_employee_category_form
msgid "Tips: Merge local and remote datasets"
Expand Down
8 changes: 8 additions & 0 deletions wecom_hrm/models/wecom_contacts_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ class WxworkContactsBlock(models.Model):

wecom_userid = fields.Char(string="WeCom user Id", required=True)

_sql_constraints = [
(
"userid_company_uniq",
"unique (wecom_userid, company_id)",
"The user ID of each company must be unique!",
),
]

@api.depends("company_id", "wecom_userid")
def _compute_name(self):
for block in self:
Expand Down
45 changes: 25 additions & 20 deletions wecom_material/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-18 01:30+0000\n"
"PO-Revision-Date: 2021-12-18 09:31+0800\n"
"POT-Creation-Date: 2022-01-27 09:03+0000\n"
"PO-Revision-Date: 2022-01-27 17:04+0800\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: zh_CN\n"
Expand Down Expand Up @@ -48,15 +48,15 @@ msgid "Agent ID"
msgstr "应用ID"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "Allowed file formats are %s"
msgstr "允许的文件格式为 %s"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid ""
"Already uploaded, please do not upload again! You can create a new record to "
Expand Down Expand Up @@ -123,8 +123,8 @@ msgid "Display Name"
msgstr "显示名称"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "Error saving file to path %s!"
msgstr "文件保存到路径 %s 错误!"
Expand All @@ -134,6 +134,11 @@ msgstr "文件保存到路径 %s 错误!"
msgid "Gamification"
msgstr "游戏化"

#. module: wecom_material
#: model_terms:ir.ui.view,arch_db:wecom_material.res_config_settings_view_form
msgid "Get application info"
msgstr "获取应用信息"

#. module: wecom_material
#: model_terms:ir.ui.view,arch_db:wecom_material.wecom_material_filter
msgid "Group By"
Expand Down Expand Up @@ -181,8 +186,8 @@ msgstr "素材"

#. module: wecom_material
#. openerp-web
#: code:addons/wecom_material/static/src/xml/anchor.xml:0
#: code:addons/wxwork/wecom_material/static/src/xml/anchor.xml:0
#: code:addons/wecom/wecom_material/static/src/xml/wecom_settings_navigation.xml:0
#: code:addons/wecom_material/static/src/xml/wecom_settings_navigation.xml:0
#, python-format
msgid "Material settings"
msgstr "素材设置"
Expand All @@ -198,8 +203,8 @@ msgid "Media file identification"
msgstr "媒体文件标识"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "Media file size must be between %sB and %sMB"
msgstr "媒体文件大小必须在 %sB 和 %sMB 之间"
Expand Down Expand Up @@ -229,6 +234,11 @@ msgstr "消息"
msgid "Name"
msgstr "名称"

#. module: wecom_material
#: model:wecom.apps,app_name:wecom_material.wecom_app_first_self_app
msgid "ODOO"
msgstr ""

#. module: wecom_material
#: model:ir.model.fields.selection,name:wecom_material.selection__wecom_material__media_type__file
msgid "Ordinary file"
Expand Down Expand Up @@ -256,8 +266,8 @@ msgstr ""
"件不超过10m,文件格式:MP4,文件大小应在5B到10m之间正常文件大小不超过20m"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "Please upload files!"
msgstr "请上传文件!"
Expand All @@ -283,25 +293,20 @@ msgid "The URL of the picture obtained after uploading. Permanently valid."
msgstr "上传后获得的图片的URL。永久有效。"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "The duration of the voice file exceeds 60 seconds!"
msgstr "语音文件的时长超过60秒!"

#. module: wecom_material
#: model:wecom.apps,app_name:wecom_material.wecom_app_first_self_app
msgid "The first application you built yourself."
msgstr "您构建的第一个应用。"

#. module: wecom_material
#: model:ir.model.constraint,message:wecom_material.constraint_wecom_material_name_company_uniq
msgid "The material name of each company must be unique !"
msgstr "每个公司的素材名称必须是唯一的!"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "The temporary material has not expired, please do not upload it repeatedly."
msgstr "临时素材尚未过期,请不要重复上传。"
Expand All @@ -314,15 +319,15 @@ msgid ""
msgstr "媒体文件上传后获取的唯一标识,3天内有效"

#. module: wecom_material
#: code:addons/wecom/wecom_material/__init__.py:0
#: code:addons/wecom_material/__init__.py:0
#: code:addons/wxwork/wecom_material/__init__.py:0
#, python-format
msgid "Unable to create WeCom image storage path! Error:%s"
msgstr "无法创建企业微信图像存储路径!错误:%s"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "Unknown type of media file!"
msgstr "未知媒体文件类型!"
Expand Down Expand Up @@ -353,8 +358,8 @@ msgid "Warning"
msgstr "警告"

#. module: wecom_material
#: code:addons/wecom/wecom_material/__init__.py:0
#: code:addons/wecom_material/__init__.py:0
#: code:addons/wxwork/wecom_material/__init__.py:0
#, python-format
msgid "WeCom image storage path has not been configured yet!"
msgstr "尚未配置企业微信图像存储路径!"
Expand All @@ -365,8 +370,8 @@ msgid "WeCom material"
msgstr "企业微信素材"

#. module: wecom_material
#: code:addons/wecom/wecom_material/models/wecom_material.py:0
#: code:addons/wecom_material/models/wecom_material.py:0
#: code:addons/wxwork/wecom_material/models/wecom_material.py:0
#, python-format
msgid "WeCom storage path has not been configured yet!"
msgstr "企业微信存储路径尚未配置!"
Expand Down
12 changes: 10 additions & 2 deletions wecom_material/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ class ResConfigSettings(models.TransientModel):

# 通讯录
material_app_id = fields.Many2one(
related="company_id.material_app_id",
readonly=False,
related="company_id.material_app_id", readonly=False,
)

material_agentid = fields.Integer(related="material_app_id.agentid", readonly=False)
material_secret = fields.Char(related="material_app_id.secret", readonly=False)
material_access_token = fields.Char(related="material_app_id.access_token")

def get_app_info(self):
"""
获取应用信息
:return:
"""
for record in self:
record.auth_app_id.get_app_info()
super(ResConfigSettings, self).get_app_info()
1 change: 1 addition & 0 deletions wecom_material/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<div class="mt8">
<field name="material_app_id" class="w-100" widget="selection" domain="['&amp;',('type_code', 'not like', '%contacts%'),('company_id', '=', company_id)]"/>
</div>
<button class="btn btn-primary" name="get_app_info" string="Get application info" type="object" icon="fa-cloud-download" attrs="{'invisible': [('material_app_id','=',False)]}"/>
</div>
</div>
</div>
Expand Down

0 comments on commit c6e6c71

Please sign in to comment.