From 5fd307b921cb94835236a5a03aa051af4c46f0d3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 21 Feb 2014 11:49:08 +0100 Subject: [PATCH] [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 --- openerp/addons/base/ir/ir_model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 311a5438d8f..01536958df1 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -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':