opt app saas

This commit is contained in:
Ivan Office
2025-02-11 16:18:11 +08:00
parent b679f1b4ae
commit 7c2d69e667
5 changed files with 13 additions and 13 deletions

View File

@@ -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.25.01.26', 'version': '18.0.25.02.11',
'author': 'odooai.cn', 'author': 'odooai.cn',
'category': 'Base', 'category': 'Base',
'website': 'https://www.odooai.cn', 'website': 'https://www.odooai.cn',

View File

@@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 18.0+e-20241031\n" "Project-Id-Version: Odoo Server 16.0+e-20241226\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-08 10:21+0000\n" "POT-Creation-Date: 2025-01-06 10:11+0000\n"
"PO-Revision-Date: 2024-11-08 10:21+0000\n" "PO-Revision-Date: 2025-01-06 10:11+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"

View File

@@ -10,7 +10,7 @@ class IrConfigParameter(models.Model):
def init(self, force=False): def init(self, force=False):
super(IrConfigParameter, self).init(force=force) super(IrConfigParameter, self).init(force=force)
if force: if force:
oauth_app_saas = self.env.ref('app_saas.ir_config_parameter.py') oauth_app_saas = self.env.ref('app_saas.provider_app_saas')
if not oauth_app_saas: if not oauth_app_saas:
return return
dbuuid = self.sudo().get_param('database.uuid') dbuuid = self.sudo().get_param('database.uuid')

View File

@@ -14,4 +14,3 @@ class ResConfigSettings(models.TransientModel):
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=None, config_parameter='app_saas_db_token', app_saas_db_token = fields.Char('Cloud DB Token', default=None, config_parameter='app_saas_db_token',
help="The odooapp SaaS Token for this Odoo Database. You can reset in https://www.odooapp.cn") help="The odooapp SaaS Token for this Odoo Database. You can reset in https://www.odooapp.cn")

View File

@@ -9,18 +9,19 @@ try:
except: except:
from urllib import request as urllib2 from urllib import request as urllib2
from odoo import api, fields, models, _ from odoo import api, fields, models, _
import requests import requests
import logging import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
class OauthBindError(Exception): class OauthBindError(Exception):
# 增加一种错误类型 # 增加一种错误类型
pass pass
class ResUsers(models.Model): class ResUsers(models.Model):
_inherit = 'res.users' _inherit = 'res.users'
@@ -75,7 +76,7 @@ class ResUsers(models.Model):
# todo: 当前同名就写 oauth 信息,不安全,要优化 # todo: 当前同名就写 oauth 信息,不安全,要优化
oauth_provider = self.env['auth.oauth.provider'].sudo().browse(provider) oauth_provider = self.env['auth.oauth.provider'].sudo().browse(provider)
if oauth_provider and oauth_provider.scope.find('odoo') >= 0: if oauth_provider and oauth_provider.scope.find('odoo') >= 0:
oauth_uid =validation.get('user_id') oauth_uid = validation.get('user_id')
if oauth_uid: if oauth_uid:
odoo_user = self.sudo().search([('login', '=', oauth_uid)], limit=1) odoo_user = self.sudo().search([('login', '=', oauth_uid)], limit=1)
if odoo_user and not (odoo_user.oauth_access_token and odoo_user.oauth_provider_id and odoo_user.oauth_uid): if odoo_user and not (odoo_user.oauth_access_token and odoo_user.oauth_provider_id and odoo_user.oauth_uid):