summaryrefslogtreecommitdiff
path: root/addons/base_setup/installer.py
diff options
context:
space:
mode:
authorRucha (Open ERP) <rpa@tinyerp.com>2011-04-27 18:59:22 +0530
committerRucha (Open ERP) <rpa@tinyerp.com>2011-04-27 18:59:22 +0530
commitbb72a48bb9437ec36188c9b48e2c68301adda4e4 (patch)
treeccb667f8ee92295568958c1fbfaa53d5eff827bd /addons/base_setup/installer.py
parent16e0db32bc50cdef03e303e1e063a16c3b2655b0 (diff)
[IMP, REF]: Improved code to install module/update state of its config wizard
* Added condition so only special config wizards are called on selection of a module bzr revid: rpa@tinyerp.com-20110427132922-wuzn8f2ilvfah1gr
Diffstat (limited to 'addons/base_setup/installer.py')
-rw-r--r--addons/base_setup/installer.py38
1 files changed, 15 insertions, 23 deletions
diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py
index 911e587d432..0309318aea0 100644
--- a/addons/base_setup/installer.py
+++ b/addons/base_setup/installer.py
@@ -120,35 +120,27 @@ class base_setup_installer(osv.osv_memory):
def execute(self, cr, uid, ids, context=None):
if context is None:
context = {}
- modules = self.pool.get('ir.module.module')
+ module_pool = self.pool.get('ir.module.module')
modules_selected = []
datas = self.read(cr, uid, ids, context=context)[0]
- key = datas.keys()
- key.remove("id")
- key.remove("progress")
- name_list = []
- for mod in key:
+ for mod in datas.keys():
+ if mod in ('id', 'progress'):
+ continue
if datas[mod] == 1:
modules_selected.append(mod)
- inst = modules.browse(
- cr, uid,
- modules.search(cr, uid,
- [('name','in',modules_selected)
- ],
- context=context),
- context=context)
- for i in inst:
- if i.state == 'uninstalled':
- sect_mod_id = i.id
- modules.state_update(cr, uid, [sect_mod_id], 'to install', ['uninstalled'], context)
+
+ module_ids = module_pool.search(cr, uid, [('name', 'in', modules_selected)], context=context)
+ for module in module_pool.browse(cr, uid, module_ids, context=context):
+ if module.state == 'uninstalled':
+ module_pool.state_update(cr, uid, [module.id], 'to install', ['uninstalled'], context)
cr.commit()
new_db, self.pool = pooler.restart_pool(cr.dbname, update_module=True)
- elif i.state == 'installed':
- if modules_selected:
- for instl in modules_selected:
- cr.execute("update ir_actions_todo set state='open' from ir_model_data as data where data.res_id = ir_actions_todo.id and data.model = 'ir.actions.todo' and data.module=%s", (instl, ))
-
- return
+ elif module.state == 'installed':
+ cr.execute("update ir_actions_todo set state='open' \
+ from ir_model_data as data where data.res_id = ir_actions_todo.id \
+ and ir_actions_todo.type='special'\
+ and data.model = 'ir.actions.todo' and data.module=%s", (module.name, ))
+ return
base_setup_installer()