[FIX] product: pricelist based on supplier price

In the case of a purchase pricelist based on the supplier price, the
price selected is incorrect if the supplier is not in the list of
suppliers of the product. Indeed, in this case, the price of the first
supplier is chosen.

We also need to make sure to go through all the pricelist items found.

opw-678440
This commit is contained in:
Nicolas Martinelli
2016-06-07 16:03:07 +02:00
parent 6b7caa0bc0
commit 7613cb36d6
+3 -2
View File
@@ -312,7 +312,8 @@ class product_pricelist(osv.osv):
if (not partner) or (seller_id.name.id != partner):
continue
seller = seller_id
if not seller and product.seller_ids:
# DO NOT FORWARDPORT
if not seller and product.seller_ids and rule.price_version_id.pricelist_id.type == 'sale':
seller = product.seller_ids[0]
if seller:
qty_in_seller_uom = qty
@@ -359,7 +360,7 @@ class product_pricelist(osv.osv):
price = min(price, price_limit + price_max_margin)
rule_id = rule.id
break
break
# Final price conversion to target UoM
price = product_uom_obj._compute_price(cr, uid, price_uom_id, price, qty_uom_id)