Browse Source

[FIX] Label

[FIX] Catch attempt to unlink field from nonexisting model
pull/95/head
Stefan Rijnhart 11 years ago
parent
commit
b0da1f4fb9
  1. 9
      database_cleanup/model/purge_models.py
  2. 2
      database_cleanup/model/purge_tables.py

9
database_cleanup/model/purge_models.py

@ -80,9 +80,14 @@ class CleanupPurgeLineModel(orm.TransientModel):
cr, uid, constraint_ids, context=context)
relation_ids = fields_pool.search(
cr, uid, [('relation', '=', row[1])], context=context)
if relation_ids:
fields_pool.unlink(cr, uid, relation_ids,
for relation in relation_ids:
try:
# 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)
line.write({'purged': True})
cr.commit()

2
database_cleanup/model/purge_tables.py

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

Loading…
Cancel
Save