← Back to team overview

credativ team mailing list archive

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

 

Sylvain LE GAL (GRAP) has proposed merging lp:~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name into lp:openupgrade-addons.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)
Related bugs:
  Bug #1227929 in OpenUpgrade Addons: "[7.0] Incorrect behaviour for account.invoice.line migration (note & name)"
  https://bugs.launchpad.net/openupgrade-addons/+bug/1227929

For more details, see:
https://code.launchpad.net/~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name/+merge/186696
-- 
https://code.launchpad.net/~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name/+merge/186696
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~sylvain-legal/openupgrade-addons/7.0-fix-account-move-line-name into lp:openupgrade-addons.
=== modified file 'account/migrations/7.0.1.1/post-migration.py'
--- account/migrations/7.0.1.1/post-migration.py	2013-09-09 20:56:30 +0000
+++ account/migrations/7.0.1.1/post-migration.py	2013-09-20 00:42:11 +0000
@@ -40,20 +40,19 @@
     new text field name on the invoice line.
     """
     invoice_line_obj = pool.get('account.invoice.line')
-    note_column = openupgrade.get_legacy_name('note')
-    cr.execute(
-        """
-        SELECT id, %s, %s
+    
+    cr.execute("""
+        SELECT id, {0}, {1}
         FROM account_invoice_line
-        WHERE %s is not NULL
-        AND %s != ''
-        """ % (openupgrade.get_legacy_name('name'),
-               note_column, note_column, note_column))
+        WHERE {1} is not NULL AND {1} != ''
+        """.format(
+            'name',
+            openupgrade.get_legacy_name('note')))
     for (invoice_line_id, name, note) in cr.fetchall():
-        prefix = (name + '\n') if name else ''
+        name = name + '\n' if name else ''
         invoice_line_obj.write(
             cr, SUPERUSER_ID, [invoice_line_id],
-            {'name': prefix + note})
+            {'name': name + note})
 
 def lock_closing_reconciliations(cr, pool):
     """

=== modified file 'account/migrations/7.0.1.1/pre-migration.py'
--- account/migrations/7.0.1.1/pre-migration.py	2013-09-09 20:56:30 +0000
+++ account/migrations/7.0.1.1/pre-migration.py	2013-09-20 00:42:11 +0000
@@ -30,7 +30,6 @@
         ],
     'account_invoice_line':
         [
-        ('name', None),
         ('note', None),
         ],
     'account_cashbox_line':


Follow ups