summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRifakat Haradwala (Open ERP) <rha@tinyerp.com>2011-05-17 17:14:45 +0530
committerRifakat Haradwala (Open ERP) <rha@tinyerp.com>2011-05-17 17:14:45 +0530
commitcc571cfa15a2906db07feec7c44c6ffaebc4a2a0 (patch)
tree92a9917818256b2414aab6fc090de8b5fb0ac0fb
parentda73b7682803da82f75bddfc7aea2ad441af23f3 (diff)
[FIX] sale, purchase: corrected invoiced field calculation in sale and purchase
bzr revid: rha@tinyerp.com-20110517114445-a39ve1w1700zde00
-rw-r--r--addons/purchase/purchase.py2
-rw-r--r--addons/sale/sale.py4
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 = {