Merge lp:~camptocamp/openupgrade-tools/7.0-add-database_cleanup-purge-model-attachment-error into lp:~therp-nl/openupgrade-tools/7.0-add-database_cleanup

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 4
Proposed branch: lp:~camptocamp/openupgrade-tools/7.0-add-database_cleanup-purge-model-attachment-error
Merge into: lp:~therp-nl/openupgrade-tools/7.0-add-database_cleanup
Diff against target: 16 lines (+4/-2)
1 file modified
database_cleanup/model/purge_models.py (+4/-2)
To merge this branch: bzr merge lp:~camptocamp/openupgrade-tools/7.0-add-database_cleanup-purge-model-attachment-error
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) (community) Approve
Review via email: mp+204442@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database_cleanup/model/purge_models.py'
2--- database_cleanup/model/purge_models.py 2014-01-29 09:33:06 +0000
3+++ database_cleanup/model/purge_models.py 2014-02-03 10:34:20 +0000
4@@ -65,8 +65,10 @@
5 row = cr.fetchone()
6 if row:
7 self.logger.info('Purging model %s', row[1])
8- attachment_ids = attachment_pool.search(
9- cr, uid, [('res_model', '=', line.name)], context=context)
10+ cr.execute(
11+ "UPDATE ir_attachment SET res_model = FALSE "
12+ "WHERE id in %s",
13+ (tuple(attachment_ids), ))
14 if attachment_ids:
15 attachment_pool.write(
16 cr, uid, attachment_ids, {'res_model': False},

Subscribers

People subscribed via source and target branches

to all changes: