mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update po
This commit is contained in:
@@ -10,7 +10,7 @@ from odoo.tools import pycompat
|
|||||||
from odoo.tests import common
|
from odoo.tests import common
|
||||||
ADMIN_USER_ID = common.ADMIN_USER_ID
|
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:
|
if not sep:
|
||||||
sep = '/'
|
sep = '/'
|
||||||
dir_split = content_path.split(sep)
|
dir_split = content_path.split(sep)
|
||||||
@@ -28,7 +28,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,
|
||||||
@@ -44,10 +45,12 @@ 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"]
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user