From b52467afb28034ae3016fa47f09f8a95be73def2 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 18 Jan 2016 18:18:08 +0100 Subject: [PATCH] [FIX] product: pricelist applied on product categories This is related to revision 2ebbcba33a7034d737e25c25af0e74dc76db844d The above revision introduces a regression: the ability to configure pricelist items applied on product categories. If you configured a pricelist with items applied on products categories, then the first item with a product category matched all products, even if the products were not in the according category. This is because the condition checking that the product is within the pricelist item product category has been completely removed, by the above commit. opw-666059 --- addons/product/pricelist.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index ab8c84f6433..d1b01f15de0 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -193,6 +193,15 @@ class product_pricelist(osv.osv): if rule.product_id and product.id != rule.product_id.id: continue + if rule.categ_id: + cat = product.categ_id + while cat: + if cat.id == rule.categ_id.id: + break + cat = cat.parent_id + if not cat: + continue + if rule.base == 'pricelist' and rule.base_pricelist_id: price_tmp = self._price_get_multi(cr, uid, rule.base_pricelist_id, [(product, qty, partner)], context=context)[product.id] ptype_src = rule.base_pricelist_id.currency_id.id