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

pull/95/head
unknown 2014-02-05 17:22:55 +01:00 committed by Stefan Rijnhart
commit c2722d7caf
1 changed files with 4 additions and 2 deletions

View File

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