From 893a8fb7f8888bf83fc8d7d0287ff4119d10e5c8 Mon Sep 17 00:00:00 2001 From: "Jay Vora (OpenERP)" Date: Thu, 7 Jul 2011 16:20:50 +0530 Subject: [PATCH] [FIX] Sale/Purchase : Calculation of invoice rates corrected,revert of previous commit http://bazaar.launchpad.net/~openerp/openobject-addons/6.0/revision/4593 lp bug: https://launchpad.net/bugs/795026 fixed bzr revid: jvo@tinyerp.com-20110707105050-1ql2jji5pmblsu22 --- addons/purchase/purchase.py | 5 +++-- addons/sale/sale.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 46f36142090..d95a76f610a 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -98,9 +98,10 @@ class purchase_order(osv.osv): tot = 0.0 for invoice in purchase.invoice_ids: if invoice.state not in ('draft','cancel'): - tot += invoice.amount_untaxed - invoice.residual + 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 diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 2b218f7e5cf..6e64c6589e9 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -131,7 +131,7 @@ class sale_order(osv.osv): tot = 0.0 for invoice in sale.invoice_ids: if invoice.state not in ('draft', 'cancel'): - tot += invoice.amount_untaxed - invoice.residual + tot += invoice.amount_untaxed if tot: res[sale.id] = min(100.0, tot * 100.0 / (sale.amount_untaxed or 1.00)) else: