From 8b553fd6e98f57fadc1e5074fe93a775e082b586 Mon Sep 17 00:00:00 2001 From: "Dharti Ratani (OpenERP)" Date: Wed, 30 May 2012 15:42:04 +0530 Subject: [PATCH] [IMP]uninstalling module on uncheck from configuration wizard bzr revid: dhr@tinyerp.com-20120530101204-23et36teugo13ivb --- openerp/addons/base/res/res_config.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py index f28b023eddd..a65bbecb677 100644 --- a/openerp/addons/base/res/res_config.py +++ b/openerp/addons/base/res/res_config.py @@ -502,7 +502,7 @@ class res_config_settings(osv.osv_memory): 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'] = True + res[name]['readonly'] = False return res def execute(self, cr, uid, ids, context=None): @@ -534,10 +534,14 @@ class res_config_settings(osv.osv_memory): # module fields: install immediately the selected modules to_install_ids = [] for name, module in classified['module']: - if config[name] and module.state == 'uninstalled': - to_install_ids.append(module.id) + 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: + ir_module.module_uninstall(cr, uid, to_uninstall_ids, context) # force client-side reload (update user menu and current view) return {