From f32adf267a672519e1fc6125fcf596e6e6c504d8 Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 21 Dec 2010 15:54:10 +0530 Subject: [PATCH] [FIX] sale_marging: Calculated cost price as per pricelist lp bug: https://launchpad.net/bugs/689924 fixed bzr revid: pso@tinyerp.com-20101221102410-lylp224ghp45qkpi --- addons/sale_margin/sale_margin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py index 97fd3b29cef..f7bbf41e5d3 100644 --- a/addons/sale_margin/sale_margin.py +++ b/addons/sale_margin/sale_margin.py @@ -29,9 +29,12 @@ class sale_order_line(osv.osv): res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag) + frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id + to_cur = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.currency_id.id if product: purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price - res['value'].update({'purchase_price': purchase_price}) + price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False) + res['value'].update({'purchase_price': price}) return res def _product_margin(self, cr, uid, ids, field_name, arg, context=None):