diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-12-11 17:07:46 +0100 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-12-11 17:07:46 +0100 |
| commit | cfe89367cdca32a42788778c2f108f4d316bef98 (patch) | |
| tree | 218e3cf9aad1718cead971d4f0f34d7d16a52fc4 /bin/addons/base/module/module.py | |
| parent | ff8b88d8fdd46cca77f337ce28b25864fe59515d (diff) | |
[IMP] improve rapidity
bzr revid: christophe@tinyerp.com-20081211160746-h111up81ofun9asg
Diffstat (limited to 'bin/addons/base/module/module.py')
| -rw-r--r-- | bin/addons/base/module/module.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 5ed36511d95..9a5ba75a57d 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -259,10 +259,20 @@ class module(osv.osv): for dep in depobj.browse(cr, uid, iids, context=context): if dep.module_id.state=='installed': todo.append(dep.module_id) - + ids = map(lambda x: x.id, todo) self.write(cr, uid, ids, {'state':'to upgrade'}, context=context) - self.button_install(cr, uid, ids, context=context) + + to_install = [] + for mod in todo: + for dep in mod.dependencies_id: + if dep.state == 'unknown': + raise orm.except_orm(_('Error'), _('You try to upgrade a module that depends on the module: %s.\nBut this module is not available in your system.') % (dep.name,)) + 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 def button_upgrade_cancel(self, cr, uid, ids, context={}): |
