From 7613cb36d62f6dea93f1d184bb2cd67e14bc0c30 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 7 Jun 2016 14:38:09 +0200 Subject: [PATCH] [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 --- addons/product/pricelist.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index d63b1744bb6..a621f5449f5 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -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)