[FIX] fix with detection of dependencies

lp bug: https://launchpad.net/bugs/307393 fixed

bzr revid: christophe@tinyerp.com-20081212141436-s3n6410mhuddm3ru
This commit is contained in:
Christophe Simonis 2008-12-12 15:14:36 +01:00
parent 43f0fffd07
commit 5a38fc4899
2 changed files with 9 additions and 7 deletions

View File

@ -538,16 +538,18 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
modobj = pool.get('ir.module.module')
modobj.update_list(cr, 1)
mods = [k for k in tools.config['init'] if tools.config['init'][k]]
if mods:
ids = modobj.search(cr, 1, ['&', ('state', '=', 'uninstalled'), ('name', 'in', mods)])
if ids:
modobj.button_install(cr, 1, ids)
ids = modobj.search(cr, 1, ['&', '!', ('name', '=', 'base'), ('state', 'in', ('installed', 'to upgrade'))])
if ids:
modobj.button_upgrade(cr, 1, ids)
mods = [k for k in tools.config['update'] if tools.config['update'][k]]
if mods:
ids = modobj.search(cr, 1, ['&', '&',('state', '=', 'installed'), ('name', 'in', mods), '!', ('name', '=', 'base')])
if ids:
modobj.button_upgrade(cr, 1, ids)
cr.execute("select name from ir_module_module where state in ('installed', 'to install', 'to upgrade','to remove')")
else:

View File

@ -257,7 +257,7 @@ class module(osv.osv):
_("Can not upgrade module '%s'. It is not installed.") % (mod.name,))
iids = depobj.search(cr, uid, [('name', '=', mod.name)], context=context)
for dep in depobj.browse(cr, uid, iids, context=context):
if dep.module_id.state=='installed':
if dep.module_id.state=='installed' and dep.module_id not in todo:
todo.append(dep.module_id)
ids = map(lambda x: x.id, todo)
@ -271,7 +271,7 @@ class module(osv.osv):
if dep.state == 'uninstalled':
ids2 = self.search(cr, uid, [('name','=',dep.name)])
to_install.extend(ids2)
self.button_install(cr, uid, to_install, context=context)
return True