[FIX] Label

[FIX] Catch attempt to unlink field from nonexisting model
pull/95/head
Stefan Rijnhart 2014-03-14 14:21:11 +01:00
parent 077f4c500a
commit b0da1f4fb9
2 changed files with 9 additions and 4 deletions

View File

@ -80,9 +80,14 @@ class CleanupPurgeLineModel(orm.TransientModel):
cr, uid, constraint_ids, context=context) cr, uid, constraint_ids, context=context)
relation_ids = fields_pool.search( relation_ids = fields_pool.search(
cr, uid, [('relation', '=', row[1])], context=context) cr, uid, [('relation', '=', row[1])], context=context)
if relation_ids: for relation in relation_ids:
fields_pool.unlink(cr, uid, relation_ids, try:
context=local_context) # Fails if the model on the target side
# cannot be instantiated
fields_pool.unlink(cr, uid, [relation],
context=local_context)
except AttributeError:
pass
model_pool.unlink(cr, uid, [row[0]], context=local_context) model_pool.unlink(cr, uid, [row[0]], context=local_context)
line.write({'purged': True}) line.write({'purged': True})
cr.commit() cr.commit()

View File

@ -88,7 +88,7 @@ class CleanupPurgeWizardTable(orm.TransientModel):
res = super(CleanupPurgeWizardTable, self).default_get( res = super(CleanupPurgeWizardTable, self).default_get(
cr, uid, fields, context=context) cr, uid, fields, context=context)
if 'name' in fields: if 'name' in fields:
res['name'] = _('Purge modules') res['name'] = _('Purge tables')
return res return res
def find(self, cr, uid, context=None): def find(self, cr, uid, context=None):