summaryrefslogtreecommitdiff
path: root/bin/addons/base/module/module.py
diff options
context:
space:
mode:
authorSylvain Calador @ Logical Soft <>2009-12-31 15:42:09 +0530
committerJay (Open ERP) <jvo@tinyerp.com>2009-12-31 15:42:09 +0530
commit43ce223944dc49ac2d94434bb22de3c072ac166b (patch)
tree121a98f9c37f23fcba36661ec023b77bcd66808d /bin/addons/base/module/module.py
parent3477398a60b08aafa311f5877f556d23cd35d3a2 (diff)
[FIX] Corrections made when removing a module and updating the module database: Entry from ir_model_data should also be removed when moudle is removed
lp bug: https://launchpad.net/bugs/490337 fixed bzr revid: jvo@tinyerp.com-20091231101209-fry0iikmhhlgba1n
Diffstat (limited to 'bin/addons/base/module/module.py')
-rw-r--r--bin/addons/base/module/module.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py
index 6f818a69041..435f315efe6 100644
--- a/bin/addons/base/module/module.py
+++ b/bin/addons/base/module/module.py
@@ -197,10 +197,18 @@ class module(osv.osv):
return True
if isinstance(ids, (int, long)):
ids = [ids]
- for mod in self.read(cr, uid, ids, ['state'], context):
+ mod_names = []
+ for mod in self.read(cr, uid, ids, ['state','name'], context):
if mod['state'] in ('installed', 'to upgrade', 'to remove', 'to install'):
raise orm.except_orm(_('Error'),
_('You try to remove a module that is installed or will be installed'))
+ mod_names.append(mod['name'])
+ #Removing the entry from ir_model_data
+ ids_meta = self.pool.get('ir.model.data').search(cr, uid, [('name', '=', 'module_meta_information'), ('module', 'in', mod_names)])
+
+ if ids_meta:
+ self.pool.get('ir.model.data').unlink(cr, uid, ids_meta, context)
+
return super(module, self).unlink(cr, uid, ids, context=context)
def state_update(self, cr, uid, ids, newstate, states_to_update, context={}, level=100):