Merge lp:~arifmlpm/openobject-addons/arif-openobject-addons into lp:openobject-addons

Proposed by Arif
Status: Merged
Merged at revision: 6613
Proposed branch: lp:~arifmlpm/openobject-addons/arif-openobject-addons
Merge into: lp:openobject-addons
Diff against target: 19 lines (+5/-1)
1 file modified
sale/sale.py (+5/-1)
To merge this branch: bzr merge lp:~arifmlpm/openobject-addons/arif-openobject-addons
Reviewer Review Type Date Requested Status
qdp (OpenERP) Approve
Review via email: mp+92968@code.launchpad.net

Description of the change

It contain the bug fix for the confirmed bug

https://bugs.launchpad.net/openobject-addons/+bug/929373

Kind Regds,
Arif

To post a comment you must log in.
Revision history for this message
qdp (OpenERP) (qdp) wrote :

Hello Arif,

Thanks for your contribution. I just improved your code in order to remove the extra loop, and to use a flag instead of a list.

FYI, here is the patch i merged
=== modified file 'sale/sale.py'
--- sale/sale.py 2012-02-15 17:32:52 +0000
+++ sale/sale.py 2012-02-16 16:22:11 +0000
@@ -147,11 +147,14 @@
         res = {}
         for sale in self.browse(cursor, user, ids, context=context):
             res[sale.id] = True
+ invoice_existence = False
             for invoice in sale.invoice_ids:
- if invoice.state != 'paid':
- res[sale.id] = False
- break
- if not sale.invoice_ids:
+ if invoice.state != 'cancel':
+ invoice_existence = True
+ if invoice.state != 'paid':
+ res[sale.id] = False
+ break
+ if not invoice_existence:
                 res[sale.id

review: Approve
Revision history for this message
Arif (arifmlpm) wrote :

Thank you very much.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sale/sale.py'
--- sale/sale.py 2012-02-14 12:25:20 +0000
+++ sale/sale.py 2012-02-14 13:05:22 +0000
@@ -147,11 +147,15 @@
147 res = {}147 res = {}
148 for sale in self.browse(cursor, user, ids, context=context):148 for sale in self.browse(cursor, user, ids, context=context):
149 res[sale.id] = True149 res[sale.id] = True
150 invoices = []
150 for invoice in sale.invoice_ids:151 for invoice in sale.invoice_ids:
152 if invoice.state!='cancel':
153 invoices.append(invoice)
154 for invoice in invoices:
151 if invoice.state != 'paid':155 if invoice.state != 'paid':
152 res[sale.id] = False156 res[sale.id] = False
153 break157 break
154 if not sale.invoice_ids:158 if not invoices:
155 res[sale.id] = False159 res[sale.id] = False
156 return res160 return res
157161

Subscribers

People subscribed via source and target branches

to all changes: