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

Proposed by Guewen Baconnier @ Camptocamp on 2014-02-06
Status: Merged
Merged at revision: 6
Proposed branch: lp:~camptocamp/openupgrade-tools/7.0-add-database_cleanup-purge-model-attachment-error2
Merge into: lp:~therp-nl/openupgrade-tools/7.0-add-database_cleanup
Diff against target: 24 lines (+6/-7)
1 file modified
database_cleanup/model/purge_models.py (+6/-7)
To merge this branch: bzr merge lp:~camptocamp/openupgrade-tools/7.0-add-database_cleanup-purge-model-attachment-error2
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) (community) 2014-02-06 Approve on 2014-02-06
Review via email: mp+205125@code.launchpad.net
To post a comment you must log in.

Thanks! My bad for merging the proposal blindly...

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-02-05 16:23:57 +0000
3+++ database_cleanup/model/purge_models.py 2014-02-06 11:09:29 +0000
4@@ -66,14 +66,13 @@
5 row = cr.fetchone()
6 if row:
7 self.logger.info('Purging model %s', row[1])
8- cr.execute(
9- "UPDATE ir_attachment SET res_model = FALSE "
10- "WHERE id in %s",
11- (tuple(attachment_ids), ))
12+ attachment_ids = attachment_pool.search(
13+ cr, uid, [('res_model', '=', line.name)], context=context)
14 if attachment_ids:
15- attachment_pool.write(
16- cr, uid, attachment_ids, {'res_model': False},
17- context=context)
18+ cr.execute(
19+ "UPDATE ir_attachment SET res_model = FALSE "
20+ "WHERE id in %s",
21+ (tuple(attachment_ids), ))
22 constraint_ids = constraint_pool.search(
23 cr, uid, [('model', '=', line.name)], context=context)
24 if constraint_ids:

Subscribers

People subscribed via source and target branches

to all changes: