← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~yann-papouin/ocb-addons/6.1-bug-1077931-fix-purchase-invoiced-rate into lp:ocb-addons/6.1

 

Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/6.1-bug-1077931-fix-purchase-invoiced-rate into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1077931 in OpenERP Community Backports (Addons): "[6.1][7.0][trunk] purchase progress bar invoiced_rate wrong"
  https://bugs.launchpad.net/ocb-addons/+bug/1077931

For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-1077931-fix-purchase-invoiced-rate/+merge/205145
-- 
https://code.launchpad.net/~yann-papouin/ocb-addons/6.1-bug-1077931-fix-purchase-invoiced-rate/+merge/205145
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/6.1-bug-1077931-fix-purchase-invoiced-rate into lp:ocb-addons/6.1.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2013-11-20 01:17:39 +0000
+++ purchase/purchase.py	2014-02-06 12:31:06 +0000
@@ -90,10 +90,10 @@
         for purchase in self.browse(cursor, user, ids, context=context):
             tot = 0.0
             for invoice in purchase.invoice_ids:
-                if invoice.state not in ('draft','cancel'):
+                if invoice.state not in ('draft','cancel') and invoice.type == 'in_invoice':
                     tot += invoice.amount_untaxed
             if purchase.amount_untaxed:
-                res[purchase.id] = tot * 100.0 / purchase.amount_untaxed
+                res[purchase.id] = min(100.0, tot * 100.0 / purchase.amount_untaxed)
             else:
                 res[purchase.id] = 0.0
         return res


Follow ups