Please review this at http://codereview.appspot.com/3398042/

Affected files:
  M CHANGELOG
  M invoice.py


Index: CHANGELOG
===================================================================
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+* Change get_move_line on Invoice Line and Tax to return a list of values
+  instead of values
+
 Version 1.8.0 - 2010-11-01
 * Bug fixes (see mercurial logs for details)

Index: invoice.py
===================================================================
--- a/invoice.py
+++ b/invoice.py
@@ -712,7 +712,7 @@
         for line in invoice.lines:
             val = line_obj.get_move_line(line)
             if val:
-                res.append(val)
+                res.extend(val)
         return res

     def _get_move_line_invoice_tax(self, invoice):
@@ -724,7 +724,7 @@
         for tax in invoice.taxes:
             val = tax_obj.get_move_line(tax)
             if val:
-                res.append(val)
+                res.extend(val)
         return res

     def _get_move_line(self, invoice, date, amount):
@@ -1669,12 +1669,12 @@

     def get_move_line(self, line):
         '''
-        Return move line value for invoice line
+        Return a list of move lines values for invoice line
         '''
         currency_obj = self.pool.get('currency.currency')
         res = {}
         if line.type != 'line':
-            return res
+            return []
         res['name'] = line.description
         if line.invoice.currency.id != line.invoice.company.currency.id:
             amount = currency_obj.compute(line.invoice.currency,
line.amount,
@@ -1707,7 +1707,7 @@
         for tax in computed_taxes:
             res.setdefault('tax_lines', [])
             res['tax_lines'].append(('create', tax))
-        return res
+        return [res]

     def _credit(self, line):
         '''
@@ -1863,12 +1863,12 @@

     def get_move_line(self, tax):
         '''
-        Return move line value for invoice tax
+        Return a list move lines values for invoice tax
         '''
         currency_obj = self.pool.get('currency.currency')
         res = {}
         if not tax.amount:
-            return res
+            return []
         res['name'] = tax.description
         if tax.invoice.currency.id != tax.invoice.company.currency.id:
             amount = currency_obj.compute(tax.invoice.currency, tax.amount,
@@ -1903,7 +1903,7 @@
                 'amount': amount * tax.tax_sign,
                 'tax': tax.tax and tax.tax.id or False
             })]
-        return res
+        return [res]

     def _credit(self, tax):
         '''



-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgp4aZ23Ni1qH.pgp
Description: PGP signature

Reply via email to