update po

This commit is contained in:
Ivan Office
2024-08-26 02:52:15 +08:00
parent 9ebc31d1a1
commit f707213f7a

View File

@@ -10,7 +10,7 @@ from odoo.tools import pycompat
from odoo.tests import common
ADMIN_USER_ID = common.ADMIN_USER_ID
def app_quick_import(env, content_path, sep=None):
def app_quick_import(env, content_path, sep=None, context={}):
if not sep:
sep = '/'
dir_split = content_path.split(sep)
@@ -28,7 +28,8 @@ def app_quick_import(env, content_path, sep=None):
file_type = 'text/csv'
elif file_type in ['.xls', '.xlsx']:
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,
'file_name': file_name,
'file_type': file_type,
@@ -44,10 +45,12 @@ def app_quick_import(env, content_path, sep=None):
preview = import_wizard.parse_preview({
'has_headers': True,
})
result = import_wizard.execute_import(
else:
preview = False
if preview:
import_wizard.execute_import(
preview["headers"],
preview["headers"],
preview["options"]
)