[FIX] pricelist: correctly take into account uom when computing pricelists based on supplier price on product form (opw 595881)
The previous behaviour used the uom of product while it could be a different one selected (by default the purchase unit of measure for purchase orders). This was an issue especially when having different uom with supplier info lines setting degressive prices. The price should be computed based on selected uom and not the product uom. bzr revid: mat@openerp.com-20140211145703-9uut4hw9aqh7326o
This commit is contained in:
@@ -270,12 +270,13 @@ class product_pricelist(osv.osv):
|
||||
price = 0.0
|
||||
if sinfo:
|
||||
qty_in_product_uom = qty
|
||||
product_default_uom = product_obj.read(cr, uid, [product_id], ['uom_id'])[0]['uom_id'][0]
|
||||
from_uom = context.get('uom') or product_obj.read(cr, uid, [product_id], ['uom_id'])[0]['uom_id'][0]
|
||||
supplier = supplierinfo_obj.browse(cr, uid, sinfo, context=context)[0]
|
||||
seller_uom = supplier.product_uom and supplier.product_uom.id or False
|
||||
if seller_uom and product_default_uom and product_default_uom != seller_uom:
|
||||
if seller_uom and from_uom and from_uom != seller_uom:
|
||||
qty_in_product_uom = product_uom_obj._compute_qty(cr, uid, from_uom, qty, to_uom_id=seller_uom)
|
||||
else:
|
||||
uom_price_already_computed = True
|
||||
qty_in_product_uom = product_uom_obj._compute_qty(cr, uid, product_default_uom, qty, to_uom_id=seller_uom)
|
||||
cr.execute('SELECT * ' \
|
||||
'FROM pricelist_partnerinfo ' \
|
||||
'WHERE suppinfo_id IN %s' \
|
||||
|
||||
Reference in New Issue
Block a user