From 9e1100ae2f014ad82886fbb98d2e6deb4f6df4cd Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 23 Apr 2015 10:38:48 +0200 Subject: [PATCH] [FIX] product: pricelist specific to a product Double list comprehension is a nice try but does not work in python. prod_ids was a list containing only the first variant, so getting the product-specific pricelists only for the first variant of the first template. Fixes #2900 --- addons/product/pricelist.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 8f458ec2b89..db24e3a5e15 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -19,6 +19,7 @@ # ############################################################################## +from itertools import chain import time from openerp import tools @@ -224,7 +225,9 @@ class product_pricelist(osv.osv): is_product_template = products[0]._name == "product.template" if is_product_template: prod_tmpl_ids = [tmpl.id for tmpl in products] - prod_ids = [product.id for product in tmpl.product_variant_ids for tmpl in products] + # all variants of all products + prod_ids = [p.id for p in + list(chain.from_iterable([t.product_variant_ids for t in products]))] else: prod_ids = [product.id for product in products] prod_tmpl_ids = [product.product_tmpl_id.id for product in products]