summaryrefslogtreecommitdiff
path: root/addons/base_import_module/models
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-06-07 23:13:58 +0200
committerOlivier Dony <odo@openerp.com>2017-06-07 23:29:41 +0200
commitef82574fb1db5b40aa1b7ff5a52812ea892a2b3d (patch)
treed9a3d7277deaf023d29d0a6593b82af72e1b6997 /addons/base_import_module/models
parentfffcfcc519b6349e7a81a94b8c1666716c181e19 (diff)
parentb604f3b3daf063a621bb118befb5a0fd792f0af0 (diff)
[MERGE] Forward-port saas-6 up to b604f3b3daf063a621bb118befb5a0fd792f0af0
Diffstat (limited to 'addons/base_import_module/models')
-rw-r--r--addons/base_import_module/models/ir_module.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/addons/base_import_module/models/ir_module.py b/addons/base_import_module/models/ir_module.py
index 7f5dbe626f3..d108dd2f664 100644
--- a/addons/base_import_module/models/ir_module.py
+++ b/addons/base_import_module/models/ir_module.py
@@ -99,18 +99,23 @@ class ir_module_module(osv.osv):
raise UserError(msg % zf.filename)
with openerp.tools.osutil.tempdir() as module_dir:
- z.extractall(module_dir)
- dirs = [d for d in os.listdir(module_dir) if os.path.isdir(opj(module_dir, d))]
- for mod_name in dirs:
- module_names.append(mod_name)
- try:
- # assert mod_name.startswith('theme_')
- path = opj(module_dir, mod_name)
- self.import_module(cr, uid, mod_name, path, force=force, context=context)
- success.append(mod_name)
- except Exception, e:
- _logger.exception('Error while importing module')
- errors[mod_name] = exception_to_unicode(e)
+ import openerp.modules as addons
+ try:
+ addons.module.ad_paths.append(module_dir)
+ z.extractall(module_dir)
+ dirs = [d for d in os.listdir(module_dir) if os.path.isdir(opj(module_dir, d))]
+ for mod_name in dirs:
+ module_names.append(mod_name)
+ try:
+ # assert mod_name.startswith('theme_')
+ path = opj(module_dir, mod_name)
+ self.import_module(cr, uid, mod_name, path, force=force, context=context)
+ success.append(mod_name)
+ except Exception, e:
+ _logger.exception('Error while importing module')
+ errors[mod_name] = exception_to_unicode(e)
+ finally:
+ addons.module.ad_paths.remove(module_dir)
r = ["Successfully imported module '%s'" % mod for mod in success]
for mod, error in errors.items():
r.append("Error while importing module '%s': %r" % (mod, error))