From 6990492b3389246522f0acb246caa2bc843322c8 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 29 Feb 2012 16:41:23 +0530 Subject: [PATCH] [IMP] use methods of module to install and uninstall bzr revid: tpa@tinyerp.com-20120229111123-keka5l6txo0tx7zc --- addons/sale/res_config.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index 540fe9da97a..d407e4b445f 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -150,16 +150,13 @@ class sale_configuration(osv.osv_memory): for k, v in vals.items(): if k in MODULE_LIST: installed = self.get_default_installed_modules(cr, uid, [k], context) - if v == True and not installed: + if v == True and not installed.get(k): module_id = module_obj.search(cr, uid, [('name','=',k)])[0] - module_obj.state_update(cr, uid, [module_id], 'to install', ['uninstalled'], context) - cr.commit() - pooler.restart_pool(cr.dbname, update_module=True)[1] + module_obj.button_immediate_install(cr, uid, [module_id], context) elif v == False and installed.get(k): module_id = module_obj.search(cr, uid, [('name','=',k)])[0] - module_obj.state_update(cr, uid, [module_id], 'to remove', ['installed'], context) - cr.commit() - pooler.restart_pool(cr.dbname, update_module=True)[1] + module_obj.button_uninstall(self, cr, uid, [module_id], context=None) + module_obj.button_upgrade(self, cr, uid, [module_id], context=None) def set_sale_defaults(self, cr, uid, ids, vals, context=None): ir_values_obj = self.pool.get('ir.values')