Merge lp:~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name into lp:openupgrade-addons

Proposed by Sylvain LE GAL (GRAP)
Status: Merged
Merged at revision: 8137
Proposed branch: lp:~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name
Merge into: lp:openupgrade-addons
Diff against target: 45 lines (+9/-11)
2 files modified
account/migrations/7.0.1.1/post-migration.py (+9/-10)
account/migrations/7.0.1.1/pre-migration.py (+0/-1)
To merge this branch: bzr merge lp:~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
Review via email: mp+186696@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for the fix! Looks perfect to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/migrations/7.0.1.1/post-migration.py'
2--- account/migrations/7.0.1.1/post-migration.py 2013-09-09 20:56:30 +0000
3+++ account/migrations/7.0.1.1/post-migration.py 2013-09-20 00:42:11 +0000
4@@ -40,20 +40,19 @@
5 new text field name on the invoice line.
6 """
7 invoice_line_obj = pool.get('account.invoice.line')
8- note_column = openupgrade.get_legacy_name('note')
9- cr.execute(
10- """
11- SELECT id, %s, %s
12+
13+ cr.execute("""
14+ SELECT id, {0}, {1}
15 FROM account_invoice_line
16- WHERE %s is not NULL
17- AND %s != ''
18- """ % (openupgrade.get_legacy_name('name'),
19- note_column, note_column, note_column))
20+ WHERE {1} is not NULL AND {1} != ''
21+ """.format(
22+ 'name',
23+ openupgrade.get_legacy_name('note')))
24 for (invoice_line_id, name, note) in cr.fetchall():
25- prefix = (name + '\n') if name else ''
26+ name = name + '\n' if name else ''
27 invoice_line_obj.write(
28 cr, SUPERUSER_ID, [invoice_line_id],
29- {'name': prefix + note})
30+ {'name': name + note})
31
32 def lock_closing_reconciliations(cr, pool):
33 """
34
35=== modified file 'account/migrations/7.0.1.1/pre-migration.py'
36--- account/migrations/7.0.1.1/pre-migration.py 2013-09-09 20:56:30 +0000
37+++ account/migrations/7.0.1.1/pre-migration.py 2013-09-20 00:42:11 +0000
38@@ -30,7 +30,6 @@
39 ],
40 'account_invoice_line':
41 [
42- ('name', None),
43 ('note', None),
44 ],
45 'account_cashbox_line':

Subscribers

People subscribed via source and target branches