diff options
| author | pinky <> | 2006-12-28 11:06:46 +0000 |
|---|---|---|
| committer | pinky <> | 2006-12-28 11:06:46 +0000 |
| commit | 148efe9c55e42ba83bc92d07e49e78e470a5a17d (patch) | |
| tree | dca8d952b8531ba5373c3b19fb90ea7b9e9486fa /bin/addons/base/module/module.py | |
| parent | e4449ce90f83efe199e0403439902c37ce426f7c (diff) | |
BASE:
Function to remove installed modules
bzr revid: pinky-b26b2a3b41980a56a595a294b8915b74c9b35728
Diffstat (limited to 'bin/addons/base/module/module.py')
| -rw-r--r-- | bin/addons/base/module/module.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index ea73b96580d..80728e03d60 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -30,7 +30,7 @@ import re import urllib import os import tools -from osv import fields, osv +from osv import fields, osv, orm class module_repository(osv.osv): _name = "ir.module.repository" @@ -135,6 +135,20 @@ class module(osv.osv): return True def button_uninstall(self, cr, uid, ids, context={}): + for module in self.browse(cr, uid, ids): + cr.execute('''select m.state,m.name + from + ir_module_module_dependency d + join + ir_module_module m on (d.module_id=m.id) + where + d.name=%s and + m.state not in ('uninstalled','uninstallable','to remove')''', (module.name,)) + res = cr.fetchall() + if res: + print 'Error !' + print 'The module you are trying to remove depends on installed modules :\n' + '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res)) + raise orm.except_orm('Error', 'The module you are trying to remove depends on installed modules :\n' + '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res))) self.write(cr, uid, ids, {'state': 'to remove'}) return True |
