fixed bugs on installing module:\n *raising an error when a module to be installed is unknown or uninstalled of the system and telling which module is missing.

bzr revid: hmo@tinyerp.com-20080819124616-35yndpzazw3gvo98
This commit is contained in:
Harshad Modi 2008-08-19 18:16:16 +05:30
parent 8da94d89f8
commit 84c2b58ea3
1 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,15 @@ class wizard_info_get(wizard.interface):
mod_obj = pool.get('ir.module.module')
ids = mod_obj.search(cr, uid, [
('state', 'in', ['to upgrade', 'to remove', 'to install'])])
unmet_packages=[]
mod_dep_obj = pool.get('ir.module.module.dependency')
for mod in mod_obj.browse(cr,uid,ids):
depends_mod_ids=mod_dep_obj.search(cr,uid,[('module_id','=',mod.id)])
for dep_mod in mod_dep_obj.browse(cr,uid,depends_mod_ids):
if dep_mod.state in ('unknown','uninstalled'):
unmet_packages.append(dep_mod.name)
if len(unmet_packages):
raise wizard.except_wizard('Unmet dependency !','Following modules are uninstalled or unknown. \n\n'+'\n'.join(unmet_packages))
mod_obj.download(cr, uid, ids, context=context)
cr.commit()
db, pool = pooler.restart_pool(cr.dbname, update_module=True)