From cc571cfa15a2906db07feec7c44c6ffaebc4a2a0 Mon Sep 17 00:00:00 2001 From: "Rifakat Haradwala (Open ERP)" Date: Tue, 17 May 2011 17:14:45 +0530 Subject: [PATCH] [FIX] sale, purchase: corrected invoiced field calculation in sale and purchase bzr revid: rha@tinyerp.com-20110517114445-a39ve1w1700zde00 --- addons/purchase/purchase.py | 2 +- addons/sale/sale.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 63dbf4d9dcc..46f36142090 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -98,7 +98,7 @@ 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 + tot += invoice.amount_untaxed - invoice.residual if purchase.amount_untaxed: res[purchase.id] = tot * 100.0 / purchase.amount_untaxed else: diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 520a40b4924..2b218f7e5cf 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 + tot += invoice.amount_untaxed - invoice.residual if tot: res[sale.id] = min(100.0, tot * 100.0 / (sale.amount_untaxed or 1.00)) else: @@ -870,7 +870,7 @@ class sale_order_line(osv.osv): \n* The \'Cancelled\' state is set when a user cancel the sales order related.'), 'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', store=True, string='Customer'), 'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', store=True, string='Salesman'), - 'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft': [('readonly', False)]}), + 'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), } _order = 'sequence, id desc' _defaults = {