summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2012-06-22 11:51:26 +0200
committerRaphael Collet <rco@openerp.com>2012-06-22 11:51:26 +0200
commitab231e2165ee4cbcd032cfcfa38034dda4eae0d7 (patch)
treef4893c356373fa0ae710eca54b775c3e6b8c545a
parent2460d18bebb62d00cf4e94a78984a195f29b86cc (diff)
[IMP] res_config code cleanup
bzr revid: rco@openerp.com-20120622095126-t7yvkf29dfjktqfq
-rw-r--r--openerp/addons/base/res/res_config.py26
1 files changed, 6 insertions, 20 deletions
diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py
index 95cab12ce32..e7f54c6966e 100644
--- a/openerp/addons/base/res/res_config.py
+++ b/openerp/addons/base/res/res_config.py
@@ -496,15 +496,6 @@ class res_config_settings(osv.osv_memory):
return res
- def fields_get(self, cr, uid, allfields=None, context=None, write_access=True):
- # overridden to make fields of installed modules readonly
- res = super(res_config_settings, self).fields_get(cr, uid, allfields, context, write_access)
- classified = self._get_classified_fields(cr, uid, context)
- #for name, module in classified['module']:
- # if name in res and module.state in ('installed', 'to install', 'to upgrade'):
- # res[name]['readonly'] = False
- return res
-
def execute(self, cr, uid, ids, context=None):
ir_values = self.pool.get('ir.values')
ir_model_data = self.pool.get('ir.model.data')
@@ -531,23 +522,18 @@ class res_config_settings(osv.osv_memory):
if method.startswith('set_'):
getattr(self, method)(cr, uid, ids, context)
- # module fields: install immediately the selected modules
+ # module fields: install/uninstall the selected modules
to_install_ids = []
to_uninstall_ids = []
for name, module in classified['module']:
if config[name]:
if module.state == 'uninstalled': to_install_ids.append(module.id)
else:
- if module.state in ['installed','upgrade']: to_uninstall_ids.append(module.id)
- if to_install_ids:
- ir_module.button_immediate_install(cr, uid, to_install_ids, context)
- if to_uninstall_ids:
- # Module unInstallation.
- dep_ids = ir_module.downstream_dependencies(cr, uid, to_uninstall_ids, context=context)
- ir_module.module_uninstall(cr, uid, to_uninstall_ids + dep_ids , context)
- cr.commit()
- _logger.info('Reloading registry once more after uninstalling modules')
- pooler.restart_pool(cr.dbname, update_module=True)
+ if module.state in ('installed','upgrade'): to_uninstall_ids.append(module.id)
+
+ 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)
# force client-side reload (update user menu and current view)
return {