Bug fix - https://bugs.launchpad.net/openobject-addons/+bug/929373
authorarifmlpm@gmail.com <>
Tue, 14 Feb 2012 12:56:53 +0000 (18:26 +0530)
committerarifmlpm@gmail.com <>
Tue, 14 Feb 2012 12:56:53 +0000 (18:26 +0530)
bzr revid: arifmlpm@gmail.com-20120214125653-05w3973ostuqpe5h

addons/sale/sale.py

index d2f3ffd..c65c552 100644 (file)
@@ -147,11 +147,15 @@ class sale_order(osv.osv):
         res = {}
         for sale in self.browse(cursor, user, ids, context=context):
             res[sale.id] = True
+            invoices = []
             for invoice in sale.invoice_ids:
+                if invoice.state!='cancel':
+                    invoices.append(invoice)
+            for invoice in invoices: 
                 if invoice.state != 'paid':
                     res[sale.id] = False
                     break
-            if not sale.invoice_ids:
+            if not invoices:
                 res[sale.id] = False
         return res