[FIX] website_sale: search by attributes not work for more of one selection

This commit is contained in:
Christophe Matthieu 2014-05-27 18:20:42 +02:00
parent e987cd6c75
commit bb669f82c8
1 changed files with 8 additions and 6 deletions

View File

@ -126,19 +126,21 @@ class website_sale(http.Controller):
domain += [('product_variant_ids.public_categ_ids', 'child_of', int(category))]
attrib_values = [map(int,v.split(",")) for v in request.httprequest.args.getlist('attrib') if v]
attrib = None
if attrib_values:
attrib = None
ids = []
for value in attrib_values:
if not attrib:
attrib = value[0]
dom = [('variant_ids.value_ids', '=', value[1])]
ids.append(value[1])
elif value[0] == attrib:
dom = ['&'] + dom + [('variant_ids.value_ids', '=', value[1])]
ids.append(value[1])
else:
attrib = None
domain += dom
domain += [('variant_ids.value_ids', 'in', ids)]
attrib = value[0]
ids = [value[1]]
if attrib:
domain += dom
domain += [('variant_ids.value_ids', 'in', ids)]
attrib_set = set([v[1] for v in attrib_values])
keep = QueryURL('/shop', category=category and int(category), search=search, attrib=attrib_set)