a = sys.argv[:]
args = [x for i, x in enumerate(a) if x not in strip_args and a[max(i - 1, 0)] not in strip_args]
a = sys.argv[:]
args = [x for i, x in enumerate(a) if x not in strip_args and a[max(i - 1, 0)] not in strip_args]
- time.sleep(0.5) # wait end of sockets...
+ # FIXME http socket cannot be rebind ?!? socket seems to not be freed, even shutdown() is called
os.execv(sys.executable, [sys.executable] + args)
return
os.execv(sys.executable, [sys.executable] + args)
return
zimp.load_module(mod.name)
return res
zimp.load_module(mod.name)
return res
+ def install_by_names(self, cr, uid, names, context=None):
+ raise NotImplementedError('# TODO')
+
def install_from_urls(self, cr, uid, urls, context=None):
tmp = tempfile.mkdtemp()
try:
def install_from_urls(self, cr, uid, urls, context=None):
tmp = tempfile.mkdtemp()
try:
groups.append((name, ref(field_group), ref(field.implied_group)))
elif name.startswith('module_') and isinstance(field, fields.boolean):
mod_ids = ir_module.search(cr, uid, [('name', '=', name[7:])])
groups.append((name, ref(field_group), ref(field.implied_group)))
elif name.startswith('module_') and isinstance(field, fields.boolean):
mod_ids = ir_module.search(cr, uid, [('name', '=', name[7:])])
- modules.append((name, ir_module.browse(cr, uid, mod_ids[0], context)))
+ record = ir_module.browse(cr, uid, mod_ids[0], context) if mod_ids else None
+ modules.append((name, record))
else:
others.append(name)
else:
others.append(name)
# modules: which modules are installed/to install
for name, module in classified['module']:
# modules: which modules are installed/to install
for name, module in classified['module']:
- res[name] = module.state in ('installed', 'to install', 'to upgrade')
+ res[name] = module and module.state in ('installed', 'to install', 'to upgrade')
# other fields: call all methods that start with 'get_default_'
for method in dir(self):
# other fields: call all methods that start with 'get_default_'
for method in dir(self):
def execute(self, cr, uid, ids, context=None):
ir_values = self.pool.get('ir.values')
def execute(self, cr, uid, ids, context=None):
ir_values = self.pool.get('ir.values')
- ir_model_data = self.pool.get('ir.model.data')
ir_module = self.pool.get('ir.module.module')
ir_module = self.pool.get('ir.module.module')
- res_groups = self.pool.get('res.groups')
classified = self._get_classified_fields(cr, uid, context)
config = self.browse(cr, uid, ids[0], context)
classified = self._get_classified_fields(cr, uid, context)
config = self.browse(cr, uid, ids[0], context)
getattr(self, method)(cr, uid, ids, context)
# module fields: install/uninstall the selected modules
getattr(self, method)(cr, uid, ids, context)
# module fields: install/uninstall the selected modules
to_uninstall_ids = []
for name, module in classified['module']:
to_uninstall_ids = []
for name, module in classified['module']:
- if config[name]:
- if module.state == 'uninstalled': to_install_ids.append(module.id)
+ if module and module.state in ('installed', 'to upgrade'):
+ to_uninstall_ids.append(module.id)
- if module.state in ('installed','upgrade'): to_uninstall_ids.append(module.id)
+ to_install_names.append(name)
+
+ if to_uninstall_ids:
+ ir_module.button_immediate_uninstall(cr, uid, to_uninstall_ids, context=context)
- if to_install_ids or to_uninstall_ids:
- ir_module.button_uninstall(cr, uid, to_uninstall_ids, context=context)
- ir_module.button_immediate_install(cr, uid, to_install_ids, context=context)
+ if to_install_names:
+ return ir_module.install_by_names(cr, uid, to_install_names, context=context)
# force client-side reload (update user menu and current view)
return {
# force client-side reload (update user menu and current view)
return {