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

This commit is contained in:
Daniel Dico 2014-08-25 11:19:43 -04:00 committed by Martin Trigaux
parent 9b3f3fecfe
commit 180c4734a6
1 changed files with 3 additions and 1 deletions

View File

@ -90,9 +90,11 @@ class sale_order_line(osv.osv):
if so_pricelist.visible_discount and list_price[pricelist] != 0 and new_list_price != 0:
if product.company_id and so_pricelist.currency_id.id != product.company_id.currency_id.id:
# new_list_price is in company's currency while price in pricelist currency
ctx = context.copy()
ctx['date'] = date_order
new_list_price = self.pool['res.currency'].compute(cr, uid,
product.company_id.currency_id.id, so_pricelist.currency_id.id,
new_list_price, context=context)
new_list_price, context=ctx)
discount = (new_list_price - price) / new_list_price * 100
if discount > 0:
result['price_unit'] = new_list_price