opt app_saas

This commit is contained in:
Ivan Office
2025-01-06 18:40:38 +08:00
parent 4d18906bc2
commit 61436de907
4 changed files with 44 additions and 15 deletions

View File

@@ -3,7 +3,7 @@
<data noupdate="1">
<record id="provider_app_saas" model="auth.oauth.provider">
<field name="name">Ai Passport of odooapp.cn</field>
<field name="body">Ai通行证-Odoo中文应用商店</field>
<field name="body">Ai Passport of odooapp.cn</field>
<field name="auth_endpoint">https://www.odooapp.cn/oauth/authorize</field>
<field name="code_endpoint">https://www.odooapp.cn/oauth/token</field>
<field name="scope">odoo,profile</field>

View File

@@ -18,7 +18,12 @@ msgstr ""
#. module: app_saas
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
msgid "<strong>Save</strong> to Install Chinese PO App if downloaded."
msgstr "<strong>保存</strong> 后即可安装Odoo中文翻译模块。本模块可至Odoo中文应用商店下载。"
msgstr "<strong>保存</strong> 后可以安装本地的Odoo中文翻译模块,安装时会自动用最新 .po 文件覆盖本地的文件。"
#. module: app_saas
#: model:auth.oauth.provider,body:app_saas.provider_app_saas
msgid "Ai Passport of odooapp.cn"
msgstr "Ai通行证-Odoo中文应用商店"
#. module: app_saas
#: model:ir.model.fields,help:app_saas.field_res_config_settings__module_app_cn_po
@@ -26,16 +31,31 @@ msgstr "<strong>保存</strong> 后即可安装Odoo中文云翻译模块。本
msgid "Checked to Sync Odoo Chinese from www.odooapp.cn"
msgstr "勾选后即可启用Odoo中文云翻译相关服务由 www.odooapp.cn 提供"
#. module: app_saas
#: model:ir.model.fields,field_description:app_saas.field_res_config_settings__app_saas_db_token
msgid "Cloud DB Token"
msgstr "数据库令牌"
#. module: app_saas
#: model:ir.model,name:app_saas.model_res_config_settings
msgid "Config Settings"
msgstr "设置"
#. module: app_saas
#: model:ir.model.fields,help:app_saas.field_auth_oauth_provider__code_endpoint
msgid "Get Token from Code. Only for Code response type."
msgstr "通过Code获取Access Token。仅在 Code 响应模式下生效"
#. 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
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
msgid "https://www.odooapp.cn/my/"
msgstr "https://www.odooapp.cn/my/"
#. module: app_saas
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
msgid "Or get the app from"
@@ -48,6 +68,25 @@ msgid "SaaS Chinese PO"
msgstr "中文云翻译PO"
#. module: app_saas
#: model:ir.model.fields,field_description:social_login.field_auth_oauth_provider__code_endpoint
#: model:ir.model.fields,help:app_saas.field_res_config_settings__app_saas_db_token
msgid ""
"The odooapp SaaS Token for this Odoo Database. You can reset in "
"https://www.odooapp.cn"
msgstr "本数据库实例的令牌。首次使用Ai通行证时自动生成您也可以在我们的网站上重新生成。请访问 https://www.odooapp.cn"
#. module: app_saas
#: model_terms:ir.ui.view,arch_db:app_saas.app_res_config_settings_view_form
msgid ""
"The odooapp SaaS Token. You can get it after first time Login via Ai "
"Passport of odooapp.cn. Also you can set from"
msgstr "本数据库实例的令牌。首次使用Ai通行证时自动生成您也可以在我们的网站上重新生成。请访问 https://www.odooapp.cn"
#. module: app_saas
#: model:ir.model.fields,field_description:app_saas.field_auth_oauth_provider__code_endpoint
msgid "Token by Code Endpoint"
msgstr "Code取Token入口"
#. module: app_saas
#: model:ir.model,name:app_saas.model_res_users
msgid "User"
msgstr "用户"

View File

@@ -12,15 +12,7 @@ except:
from odoo import api, fields, models, _
from odoo.exceptions import AccessDenied, UserError
from odoo.addons.auth_signup.models.res_users import SignupError
from odoo.http import request, Response
from ast import literal_eval
import json
import requests
from datetime import timedelta
import random
import logging
_logger = logging.getLogger(__name__)
@@ -54,9 +46,7 @@ class ResUsers(models.Model):
push_client_secret = ret.pop('push_client_secret', False)
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)
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()

View File

@@ -10,7 +10,7 @@
<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"/>
<div class="content-group mt16" invisible="not module_app_cn_po" id="msg_module_app_cn_po">
<div class="content-group mt16" id="msg_module_app_cn_po">
<div class="mt16 text-warning">
<strong>Save</strong> to Install Chinese PO App if downloaded.
</div>