[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
This commit is contained in:
Sylvain Calador @ Logical Soft
2009-12-31 15:42:09 +05:30
committed by Jay (Open ERP)
parent 3477398a60
commit 43ce223944
+9 -1
View File
@@ -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):