[FIX] sale_margin: convert standard_price to SO currency before using
This commit is contained in:
parent
63ad8b9597
commit
49407e46cb
|
@ -55,7 +55,16 @@ class sale_order_line(osv.osv):
|
|||
cur = line.order_id.pricelist_id.currency_id
|
||||
res[line.id] = 0
|
||||
if line.product_id:
|
||||
tmp_margin = line.price_subtotal - ((line.purchase_price or line.product_id.standard_price) * line.product_uos_qty)
|
||||
price = line.purchase_price
|
||||
|
||||
if not price:
|
||||
from_cur = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id
|
||||
cost = line.product_id.standard_price
|
||||
ctx = context.copy()
|
||||
ctx['date'] = line.order_id.date_order
|
||||
price = self.pool['res.currency'].compute(cr, uid, from_cur.id, cur.id, cost, round=False, context=ctx)
|
||||
|
||||
tmp_margin = line.price_subtotal - (price * line.product_uos_qty)
|
||||
res[line.id] = cur_obj.round(cr, uid, cur, tmp_margin)
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue