[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
This commit is contained in:
Denis Ledoux
2016-02-18 11:37:43 +01:00
parent a8f4b3fa19
commit d73e9efc2e
+4 -2
View File
@@ -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