[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
This commit is contained in:
Martin Trigaux 2015-04-23 10:38:48 +02:00
parent a8c122cd31
commit 9e1100ae2f
1 changed files with 4 additions and 1 deletions

View File

@ -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]