Reviewers: ,


Please review this at http://codereview.tryton.org/207002/

Affected files:
  M invoice.py


Index: invoice.py
===================================================================
--- a/invoice.py
+++ b/invoice.py
@@ -185,19 +185,23 @@ class Invoice(ModelWorkflow, ModelSQL, M
         # Migration from 1.2 invoice_date is no more required
         table.not_null_action('invoice_date', action='remove')

# Migration from 2.0 invoice_report renamed into invoice_report_cache
         # to remove base64 encoding

         if (table.column_exist('invoice_report')
                 and table.column_exist('invoice_report_cache')):
-            cursor.execute('SELECT id, invoice_report '
+            cursor.execute('SELECT id '
                 'FROM "' + self._table + '"')
-            for invoice_id, report in cursor.fetchall():
+            for invoice_id in cursor.fetchall():
+                cursor.execute('SELECT invoice_report '
+                    'FROM "' + self._table + '"'
+                    'WHERE id = %s', (invoice_id,))
+                report = cursor.fetchone()[0]
                 if report:
                     report = buffer(base64.decodestring(str(report)))
                     cursor.execute('UPDATE "' + self._table + '" '
                         'SET invoice_report_cache = %s '
                         'WHERE id = %s', (report, invoice_id))
             table.drop_column('invoice_report')

         # Add index on create_date


--
[email protected] mailing list

Reply via email to