From a5b8f1e434ea0c9e207a1c8cdcda5d383529be03 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Thu, 6 Feb 2014 12:08:13 +0100 Subject: [PATCH] fix my change guewen.baconnier@camptocamp.com-20140203103254-v1mzu2uib047xb9h, wrong lines replaced... --- database_cleanup/model/purge_models.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/database_cleanup/model/purge_models.py b/database_cleanup/model/purge_models.py index 57f7f7af5..811da30fe 100644 --- a/database_cleanup/model/purge_models.py +++ b/database_cleanup/model/purge_models.py @@ -66,14 +66,13 @@ class CleanupPurgeLineModel(orm.TransientModel): row = cr.fetchone() if row: self.logger.info('Purging model %s', row[1]) - cr.execute( - "UPDATE ir_attachment SET res_model = FALSE " - "WHERE id in %s", - (tuple(attachment_ids), )) + attachment_ids = attachment_pool.search( + cr, uid, [('res_model', '=', line.name)], context=context) if attachment_ids: - attachment_pool.write( - cr, uid, attachment_ids, {'res_model': False}, - context=context) + cr.execute( + "UPDATE ir_attachment SET res_model = FALSE " + "WHERE id in %s", + (tuple(attachment_ids), )) constraint_ids = constraint_pool.search( cr, uid, [('model', '=', line.name)], context=context) if constraint_ids: