Browse Source

avoid ''NoneType' object has no attribute 'exists'' error when purging models

pull/95/head
Guewen Baconnier 11 years ago
parent
commit
d0eafda358
  1. 6
      database_cleanup/model/purge_models.py

6
database_cleanup/model/purge_models.py

@ -65,8 +65,10 @@ class CleanupPurgeLineModel(orm.TransientModel):
row = cr.fetchone()
if row:
self.logger.info('Purging model %s', row[1])
attachment_ids = attachment_pool.search(
cr, uid, [('res_model', '=', line.name)], context=context)
cr.execute(
"UPDATE ir_attachment SET res_model = FALSE "
"WHERE id in %s",
(tuple(attachment_ids), ))
if attachment_ids:
attachment_pool.write(
cr, uid, attachment_ids, {'res_model': False},

Loading…
Cancel
Save