From d73e9efc2ea2e455424013e3a07aa38836bb36bd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 18 Feb 2016 11:33:04 +0100 Subject: [PATCH] [FIX] uninstall: models no longer in the pool When attempting to uninstall a module for which models are no longer in the pool (the module is no longer is the addons path / no longer in the current release), - This isn't possible to drop the constraints, as this is no longer possible to know the table of the model. - This is no longer possible to check if the model log the accesses (`_log_access`), as the model is no longer loaded in the pool. opw-669130 --- openerp/addons/base/ir/ir_model.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 667b9cef3cc..9e50a9fbcb8 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -597,7 +597,9 @@ class ir_model_constraint(Model): ids.reverse() for data in self.browse(cr, uid, ids, context): model = data.model.model - model_obj = self.pool[model] + model_obj = self.pool.get(model) + if not model_obj: + continue name = openerp.tools.ustr(data.name) typ = data.type @@ -1214,7 +1216,7 @@ class ir_model_data(osv.osv): _logger.info('Deleting orphan external_ids %s', external_ids) self.unlink(cr, uid, external_ids) continue - if field.name in openerp.models.LOG_ACCESS_COLUMNS and self.pool[field.model]._log_access: + if field.name in openerp.models.LOG_ACCESS_COLUMNS and field.model in self.pool and self.pool[field.model]._log_access: continue if field.name == 'id': continue