[FIX] product_visible_discount: use order date to compute currency instead of current date
This commit is contained in:
parent
9b3f3fecfe
commit
180c4734a6
|
@ -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 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:
|
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
|
# 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,
|
new_list_price = self.pool['res.currency'].compute(cr, uid,
|
||||||
product.company_id.currency_id.id, so_pricelist.currency_id.id,
|
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
|
discount = (new_list_price - price) / new_list_price * 100
|
||||||
if discount > 0:
|
if discount > 0:
|
||||||
result['price_unit'] = new_list_price
|
result['price_unit'] = new_list_price
|
||||||
|
|
Loading…
Reference in New Issue