[FIX] product_visible_discount: multicurrency pricelists
When we compute the discount of a product to display (result of product_id_change), we compare prices in the currency of the product while we expect prices in the currency of the pricelist. opw 606188
This commit is contained in:
parent
eb775fc2ea
commit
f6fb2b69df
|
@ -84,10 +84,15 @@ class sale_order_line(osv.osv):
|
|||
list_price = pricelist_obj.price_get(cr, uid, [pricelist],
|
||||
product.id, qty or 1.0, partner_id, {'uom': uom,'date': date_order })
|
||||
|
||||
pricelists = pricelist_obj.read(cr,uid,[pricelist],['visible_discount'])
|
||||
so_pricelist = pricelist_obj.browse(cr, uid, pricelist, context=context)
|
||||
|
||||
new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist)
|
||||
if len(pricelists)>0 and pricelists[0]['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 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 = self.pool['res.currency'].compute(cr, uid,
|
||||
product.company_id.currency_id.id, so_pricelist.currency_id.id,
|
||||
new_list_price, context=context)
|
||||
discount = (new_list_price - price) / new_list_price * 100
|
||||
if discount > 0:
|
||||
result['price_unit'] = new_list_price
|
||||
|
|
Loading…
Reference in New Issue