[FIX] ir_model: Uninstall with orphan external ids of ir.model.fields

On uninstalling, if external ids are associated to an unexisting field, we do not try to delete the field (as it doesnt exist) and we remove the orphan external ids

bzr revid: dle@openerp.com-20140221104908-7ytdg6xkxaza05o4
This commit is contained in:
Denis Ledoux 2014-02-21 11:49:08 +01:00
parent bb3ff8b449
commit 5fd307b921
1 changed files with 4 additions and 0 deletions

View File

@ -1081,6 +1081,10 @@ class ir_model_data(osv.osv):
# Don't remove the LOG_ACCESS_COLUMNS unless _log_access
# has been turned off on the model.
field = self.pool[model].browse(cr, uid, [res_id], context=context)[0]
if not field.exists():
_logger.info('Deleting orphan external_ids %s', external_ids)
self.unlink(cr, uid, external_ids)
continue
if field.name in openerp.osv.orm.LOG_ACCESS_COLUMNS and self.pool[field.model]._log_access:
continue
if field.name == 'id':