[FIX] product_visible_discount: discount with different unit of measures
The computation of the price without pricelist should take care of the unit of measure. e.g. if computing discount for objects in dozen (on a product with price in unit), returned unit price should be (price*12) where 12 is the factor to go from dozen to unit. Otherwise the compared prices (with and without pricelist) would not use the same unit of measure and the comparaison would be inconsistent. (opw 599727)
This commit is contained in:
parent
79ebe1060d
commit
42bf0a5670
|
@ -44,6 +44,7 @@ class sale_order_line(osv.osv):
|
|||
fiscal_position=False, flag=False, context=None):
|
||||
|
||||
def get_real_price(res_dict, product_id, qty, uom, pricelist):
|
||||
"""Retrieve the price before applying the pricelist"""
|
||||
item_obj = self.pool.get('product.pricelist.item')
|
||||
price_type_obj = self.pool.get('product.price.type')
|
||||
product_obj = self.pool.get('product.product')
|
||||
|
@ -60,9 +61,8 @@ class sale_order_line(osv.osv):
|
|||
|
||||
factor = 1.0
|
||||
if uom and uom != product.uom_id.id:
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
|
||||
factor = uom_data.factor
|
||||
# the unit price is in a different uom
|
||||
factor = self.pool['product.uom']._compute_qty(cr, uid, uom, 1.0, product.uom_id.id)
|
||||
return product_read[field_name] * factor
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue