From a357aa85e58859855761eae990f62e8600204010 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 9 Dec 2008 21:37:54 +0100 Subject: [PATCH] bugfix bzr revid: fp@tinyerp.com-20081209203754-2xk5qcy0vivsjy4f --- bin/addons/__init__.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 2163e905178..7aa8a884f44 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -424,12 +424,6 @@ def load_module_graph(cr, graph, status=None, **kwargs): statusi = 0 pool = pooler.get_pool(cr.dbname) - # only if update - register_class('base') - pool.instanciate('base', cr) - modobj = pool.get('ir.module.module') - modobj.update_list(cr, 1) - # update the graph with values from the database (if exist) ## First, we set the default values for each package in graph @@ -449,12 +443,6 @@ def load_module_graph(cr, graph, status=None, **kwargs): migrations = MigrationManager(cr, graph) - mids = modobj.search(cr, 1, [('state','=','installed')]) - for m in modobj.browse(cr, 1, mids): - for dep in m.dependencies_id: - if dep.state=='uninstalled': - modobj.button_install(cr, 1, [m.id]) - for package in graph: status['progress'] = (float(statusi)+0.1)/len(graph) m = package.name @@ -538,11 +526,23 @@ def load_modules(db, force_demo=False, status=None, update_module=False): force = [] if force_demo: force.append('demo') + pool = pooler.get_pool(cr.dbname) if update_module: for module in tools.config['init']: - # FIXME lp:304807 cr.execute('update ir_module_module set state=%s where state=%s and name=%s', ('to install', 'uninstalled', module)) cr.commit() + + register_class('base') + pool.instanciate('base', cr) + modobj = pool.get('ir.module.module') + modobj.update_list(cr, 1) + + mids = modobj.search(cr, 1, [('state','in',('installed','to install'))]) + for m in modobj.browse(cr, 1, mids): + for dep in m.dependencies_id: + if dep.state=='uninstalled': + modobj.button_install(cr, 1, [m.id]) + cr.execute("select name from ir_module_module where state in ('installed', 'to install', 'to upgrade','to remove')") else: cr.execute("select name from ir_module_module where state in ('installed', 'to upgrade', 'to remove')")