opt common 18与16一致

This commit is contained in:
Ivan Office
2025-01-26 00:33:20 +08:00
parent a881585412
commit 3ae4b1aafc
5 changed files with 33 additions and 19 deletions

View File

@@ -39,7 +39,7 @@
{ {
'name': "odooAi Common Util and Tools,欧度智能基础功能及面板", 'name': "odooAi Common Util and Tools,欧度智能基础功能及面板",
'version': '18.0.24.12.13', 'version': '18.0.25.01.26',
'author': 'odooai.cn', 'author': 'odooai.cn',
'category': 'Extra tools', 'category': 'Extra tools',
'website': 'https://www.odooai.cn', 'website': 'https://www.odooai.cn',

View File

@@ -108,9 +108,11 @@ msgid "Setup the communication to odooAi Cloud"
msgstr "设置云面板" msgstr "设置云面板"
#. module: app_common #. module: app_common
#: model:ir.model.fields,help:app_common.field_res_users__login #. odoo-python
msgid "Used to log into the system" #: code:addons/app_common/wizard/mail_compose_message.py:0
msgstr "用于用户登录系统" #, python-format
msgid "This only available in Sale Order or Purchase Order"
msgstr "本操作只对销售订单和采购订单生效"
#. module: app_common #. module: app_common
#: model_terms:ir.ui.view,arch_db:app_common.app_res_config_settings_view_form #: model_terms:ir.ui.view,arch_db:app_common.app_res_config_settings_view_form
@@ -126,8 +128,17 @@ msgstr ""
msgid "https://www.odooapp.cn/apps/modules/app_saas" msgid "https://www.odooapp.cn/apps/modules/app_saas"
msgstr "https://www.odooapp.cn/apps/modules/app_saas" msgstr "https://www.odooapp.cn/apps/modules/app_saas"
#. module: app_common
#. odoo-python
#: code:addons/app_common/models/ir_ui_view.py:0
#, python-format
msgid ""
"You can Ignore this. Failed to load RelaxNG XML schema for views validation,"
" file: %s"
msgstr "此警告可忽略:载入文件失败 RelaxNG XML schema for views validation, 文件名: %s"
#. module: app_common #. module: app_common
#: model:ir.actions.act_window,name:app_common.action_odooai_cloud_config #: model:ir.actions.act_window,name:app_common.action_odooai_cloud_config
#: model_terms:ir.ui.view,arch_db:app_common.app_res_config_settings_view_form #: model_terms:ir.ui.view,arch_db:app_common.app_res_config_settings_view_form
msgid "odooAi Cloud Settings" msgid "odooAi Cloud"
msgstr "欧度智能云" msgstr "欧度智能云"

View File

@@ -1,14 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import base64
import io
import csv
import os.path import os.path
from odoo import api, fields, models, modules, tools, SUPERUSER_ID, _ from odoo import api, fields, models, modules, tools, SUPERUSER_ID, _
from odoo.tools import pycompat
def app_quick_import(env, content_path, sep=None): def app_quick_import(env, content_path, sep=None, context={}):
if not sep: if not sep:
sep = '/' sep = '/'
dir_split = content_path.split(sep) dir_split = content_path.split(sep)
@@ -26,7 +22,8 @@ def app_quick_import(env, content_path, sep=None):
file_type = 'text/csv' file_type = 'text/csv'
elif file_type in ['.xls', '.xlsx']: elif file_type in ['.xls', '.xlsx']:
file_type = 'application/vnd.ms-excel' file_type = 'application/vnd.ms-excel'
import_wizard = env['base_import.import'].create({ import_wizard = env['base_import.import'].with_context(context)
import_wizard = import_wizard.create({
'res_model': model_name, 'res_model': model_name,
'file_name': file_name, 'file_name': file_name,
'file_type': file_type, 'file_type': file_type,
@@ -42,8 +39,14 @@ def app_quick_import(env, content_path, sep=None):
preview = import_wizard.parse_preview({ preview = import_wizard.parse_preview({
'has_headers': True, 'has_headers': True,
}) })
result = import_wizard.execute_import( else:
preview["headers"], preview = False
preview["headers"],
preview["options"] if preview:
) import_wizard.execute_import(
preview["headers"],
preview["headers"],
preview["options"]
)

View File

@@ -11,5 +11,5 @@ _logger = logging.getLogger(__name__)
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
app_saas_ok = fields.Boolean('Enable CN SaaS', help="Checked to Enable www.odooapp.cn cloud service.", default=True, config_parameter='app_saas_ok') app_saas_ok = fields.Boolean('Enable CN SaaS', default=True, config_parameter='app_saas_ok',
help="Checked to Enable www.odooapp.cn cloud service.")

View File

@@ -55,7 +55,7 @@
</record> </record>
<record id="action_odooai_cloud_config" model="ir.actions.act_window"> <record id="action_odooai_cloud_config" model="ir.actions.act_window">
<field name="name">odooAi Cloud Settings</field> <field name="name">odooAi Cloud</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.config.settings</field> <field name="res_model">res.config.settings</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>