mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
udpate app_saas 增加secret 设置
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'odooapp.cn SaaS Client-Ai Passport.Odoo中文应用商店SaaS云服务客户端',
|
'name': 'odooapp.cn SaaS Client-Ai Passport.Odoo中文应用商店SaaS云服务客户端',
|
||||||
'version': '18.0.24.12.06',
|
'version': '18.0.25.01.03',
|
||||||
'author': 'odooai.cn',
|
'author': 'odooai.cn',
|
||||||
'category': 'Base',
|
'category': 'Base',
|
||||||
'website': 'https://www.odooai.cn',
|
'website': 'https://www.odooai.cn',
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ msgstr "勾选后即可启用Odoo中文云翻译,相关服务由 www.odooapp.c
|
|||||||
msgid "Config Settings"
|
msgid "Config Settings"
|
||||||
msgstr "设置"
|
msgstr "设置"
|
||||||
|
|
||||||
|
#. module: app_saas
|
||||||
|
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
|
||||||
|
msgid "https://www.odooapp.cn/apps/modules/app_cn_po"
|
||||||
|
msgstr "https://www.odooapp.cn/apps/modules/app_cn_po"
|
||||||
|
|
||||||
#. module: app_saas
|
#. module: app_saas
|
||||||
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
|
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
|
||||||
msgid "Or get the app from"
|
msgid "Or get the app from"
|
||||||
@@ -43,6 +48,6 @@ msgid "SaaS Chinese PO"
|
|||||||
msgstr "中文云翻译PO"
|
msgstr "中文云翻译PO"
|
||||||
|
|
||||||
#. module: app_saas
|
#. module: app_saas
|
||||||
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
|
#: model:ir.model.fields,field_description:social_login.field_auth_oauth_provider__code_endpoint
|
||||||
msgid "https://www.odooapp.cn/apps/modules/app_cn_po"
|
msgid "Token by Code Endpoint"
|
||||||
msgstr "https://www.odooapp.cn/apps/modules/app_cn_po"
|
msgstr "Code取Token入口"
|
||||||
|
|||||||
@@ -12,3 +12,6 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
_inherit = 'res.config.settings'
|
_inherit = 'res.config.settings'
|
||||||
|
|
||||||
module_app_cn_po = fields.Boolean('SaaS Chinese PO', help="Checked to Sync Odoo Chinese from www.odooapp.cn")
|
module_app_cn_po = fields.Boolean('SaaS Chinese PO', help="Checked to Sync Odoo Chinese from www.odooapp.cn")
|
||||||
|
app_saas_db_token = fields.Char('Cloud DB Token', default=True, config_parameter='app_saas_db_token',
|
||||||
|
help="The odooapp SaaS Token for this Odoo Database. You can reset in https://www.odooapp.cn")
|
||||||
|
|
||||||
@@ -50,9 +50,15 @@ class ResUsers(models.Model):
|
|||||||
response = requests.get(oauth_provider.code_endpoint, params=params, timeout=30)
|
response = requests.get(oauth_provider.code_endpoint, params=params, timeout=30)
|
||||||
if response.ok:
|
if response.ok:
|
||||||
ret = response.json()
|
ret = response.json()
|
||||||
# todo: 客户机首次连接时,取到的 server 端 key 写入 provider 的 client_secret
|
# 客户机首次连接时,取到的 server 端 key 写入 provider 的 client_secret
|
||||||
if ret.get('push_client_secret') and hasattr(oauth_provider, 'client_secret'):
|
push_client_secret = ret.pop('push_client_secret', False)
|
||||||
oauth_provider.write({'client_secret': ret.get('push_client_secret')})
|
if push_client_secret:
|
||||||
|
ICP = self.env['ir.config_parameter'].sudo()
|
||||||
|
app_saas_db_token = ICP.get_param('app_saas_db_token', False)
|
||||||
|
if not app_saas_db_token:
|
||||||
|
ICP.set_param('app_saas_db_token', push_client_secret)
|
||||||
|
if hasattr(oauth_provider, 'client_secret') and not oauth_provider.client_secret:
|
||||||
|
oauth_provider.write({'client_secret': push_client_secret})
|
||||||
self._cr.commit()
|
self._cr.commit()
|
||||||
return ret
|
return ret
|
||||||
return {}
|
return {}
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
<xpath expr="//field[@name='auth_endpoint']" position="after">
|
<xpath expr="//field[@name='auth_endpoint']" position="after">
|
||||||
<field name="code_endpoint"/>
|
<field name="code_endpoint"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='data_endpoint']" position="before">
|
|
||||||
<field name="user_template_id"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
|
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//setting[@id='odooai_cloud_saas_ok']" position="after">
|
<xpath expr="//setting[@id='odooai_cloud_saas_ok']" position="after">
|
||||||
<setting string="SaaS Chinese PO" help="Checked to Sync Odoo Chinese from www.odooapp.cn" id="module_app_cn_po">
|
<setting string="SaaS Chinese PO" id="module_app_cn_po" invisible="not app_saas_ok"
|
||||||
|
help="Checked to Sync Odoo Chinese from www.odooapp.cn">
|
||||||
<field name="module_app_cn_po"/>
|
<field name="module_app_cn_po"/>
|
||||||
<div class="content-group mt16" invisible="not module_app_cn_po" id="msg_module_app_cn_po">
|
<div class="content-group mt16" invisible="not module_app_cn_po" id="msg_module_app_cn_po">
|
||||||
<div class="mt16 text-warning">
|
<div class="mt16 text-warning">
|
||||||
@@ -21,6 +22,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting string="Cloud DB Token" id="set_app_saas_db_token" invisible="not app_saas_ok">
|
||||||
|
<field name="app_saas_db_token" widget="CopyClipboardChar" style="width:100%!important"/>
|
||||||
|
<div class="content-group">
|
||||||
|
<div class="text-warning">
|
||||||
|
The odooapp SaaS Token. You can get it after first time Login via Ai Passport of odooapp.cn. Also you can set from
|
||||||
|
<a href="https://www.odooapp.cn/my/" class="o_doc_link ml8"
|
||||||
|
target="_blank">https://www.odooapp.cn/my/
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</setting>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user