Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-581957-rha into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)
Related bugs:
  Bug #1077931 in OpenERP Addons: "6.1 progress bar invoiced_rate wrong"
  https://bugs.launchpad.net/openobject-addons/+bug/1077931

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-581957-rha/+merge/135880

Hello,

Fixed issue for invoice rate of the purchase order. It cumulates amount of 
supplier
invoice and supplier refund invoice.

My fix calculates the rate by considering invoice amount - refund amount.
Please provide your remark if any.

Regards,
Rifakat Haradwala
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-581957-rha/+merge/135880
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-581957-rha.
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py	2012-10-09 12:16:14 +0000
+++ purchase/purchase.py	2012-11-23 12:19:28 +0000
@@ -89,11 +89,15 @@
         res = {}
         for purchase in self.browse(cursor, user, ids, context=context):
             tot = 0.0
+            refund = 0.0
             for invoice in purchase.invoice_ids:
                 if invoice.state not in ('draft','cancel'):
-                    tot += invoice.amount_untaxed
+                    if invoice.type == 'in_invoice':
+                        tot += invoice.amount_untaxed
+                    else:
+                        refund += invoice.amount_untaxed
             if purchase.amount_untaxed:
-                res[purchase.id] = tot * 100.0 / purchase.amount_untaxed
+                res[purchase.id] = (tot - refund) * 100.0 / purchase.amount_untaxed
             else:
                 res[purchase.id] = 0.0
         return res

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to