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
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2012-02-14 12:25:20 +0000
3+++ sale/sale.py 2012-02-14 13:05:22 +0000
4@@ -147,11 +147,15 @@
5 res = {}
6 for sale in self.browse(cursor, user, ids, context=context):
7 res[sale.id] = True
8+ invoices = []
9 for invoice in sale.invoice_ids:
10+ if invoice.state!='cancel':
11+ invoices.append(invoice)
12+ for invoice in invoices:
13 if invoice.state != 'paid':
14 res[sale.id] = False
15 break
16- if not sale.invoice_ids:
17+ if not invoices:
18 res[sale.id] = False
19 return res
20

Subscribers

People subscribed via source and target branches

to all changes: