[FIX] sale_order_line: use order date to compute currency instead of current date

This commit is contained in:
Daniel Dico 2014-08-25 11:16:35 -04:00 committed by Martin Trigaux
parent 180c4734a6
commit f880d89cc4
1 changed files with 5 additions and 1 deletions

View File

@ -31,11 +31,15 @@ class sale_order_line(osv.osv):
lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
if not pricelist:
return res
if context is None:
context = {}
frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
to_cur = self.pool.get('product.pricelist').browse(cr, uid, [pricelist])[0].currency_id.id
if product:
purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False)
ctx = context.copy()
ctx['date'] = date_order
price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False, context=ctx)
res['value'].update({'purchase_price': price})
return res