From 53ca058d9967752d8d70526baa307f057330c7aa Mon Sep 17 00:00:00 2001 From: David Beal Date: Thu, 10 Nov 2016 17:21:36 +0100 Subject: [PATCH 1/3] FIX secure_uninstall --- secure_uninstall/models/module.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/secure_uninstall/models/module.py b/secure_uninstall/models/module.py index 515b75e73..3e3d4a8f7 100644 --- a/secure_uninstall/models/module.py +++ b/secure_uninstall/models/module.py @@ -24,6 +24,7 @@ class BaseModuleUpgrade(models.TransientModel): def upgrade_module(self): for elm in self: if not config.get("secure_uninstall"): + self.rollback_state_modules() raise UserError(_( "Missing configuration key\n--------------------\n" "'secure_uninstall' configuration key " @@ -31,6 +32,7 @@ class BaseModuleUpgrade(models.TransientModel): "your Odoo server configuration file: " "please set it a value")) if elm.uninstall_password not in _get_authorized_password(): + self.rollback_state_modules() raise UserError(_( "Password Error\n--------------------\n" "Provided password '%s' doesn't match with " @@ -42,3 +44,15 @@ class BaseModuleUpgrade(models.TransientModel): # keep this password in db is insecure, then we remove it elm.uninstall_password = False return super(BaseModuleUpgrade, self).upgrade_module() + + def rollback_state_modules(self): + modules = self.env['ir.module.module'].browse( + self._context.get('active_ids')) + if modules: + module_ids = modules.downstream_dependencies( + exclude_states=['uninstalled', 'uninstallable']) + module_ids = module_ids + list(modules._ids) + self.env['ir.module.module'].browse( + module_ids).button_uninstall_cancel() + self._cr.commit() + return True From 80bec5bb28da81bfc4456d019d8838ec63fda5a7 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Wed, 23 Nov 2016 17:15:27 +0100 Subject: [PATCH 2/3] Allow user to click on cancel button --- secure_uninstall/views/module_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/secure_uninstall/views/module_view.xml b/secure_uninstall/views/module_view.xml index 9bcc4cf58..6005fe701 100644 --- a/secure_uninstall/views/module_view.xml +++ b/secure_uninstall/views/module_view.xml @@ -13,7 +13,7 @@