[IMP] website_sale: convert comma to dashed for url attrib

This commit is contained in:
Christophe Matthieu 2014-06-17 17:02:03 +02:00 committed by Christophe Simonis
parent 86c6cf7a68
commit c3c922f84e
3 changed files with 7 additions and 6 deletions

View File

@ -126,7 +126,7 @@ class website_sale(http.Controller):
domain += [('product_variant_ids.public_categ_ids', 'child_of', int(category))]
attrib_list = request.httprequest.args.getlist('attrib')
attrib_values = [map(int,v.split(",")) for v in attrib_list if v]
attrib_values = [map(int,v.split("-")) for v in attrib_list if v]
attrib_set = set([v[1] for v in attrib_values])
if attrib_values:
@ -201,7 +201,7 @@ class website_sale(http.Controller):
category = category_obj.browse(request.cr, request.uid, int(category), context=request.context)
attrib_list = request.httprequest.args.getlist('attrib')
attrib_values = [map(int,v.split(",")) for v in attrib_list if v]
attrib_values = [map(int,v.split("-")) for v in attrib_list if v]
attrib_set = set([v[1] for v in attrib_values])
keep = QueryURL('/shop', category=category and category.id, search=search, attrib=attrib_list)

View File

@ -24,6 +24,7 @@
<record id="product_product_1" model="product.product">
<field name="name">Warranty</field>
<field name="list_price">20.0</field>
<field name="website_published" eval="True"/>
<field name="type">service</field>
<field name="uom_id" ref="product.product_uom_unit"/>
<field name="uom_po_id" ref="product.product_uom_unit"/>

View File

@ -31,7 +31,7 @@
<template id="search" name="Search hidden fields">
<t t-if="attrib_values">
<t t-foreach="attrib_values" t-as="a">
<input type="hidden" name="attrib" t-att-value="'%s,%s' % (a[0], a[1])"/>
<input type="hidden" name="attrib" t-att-value="'%s-%s' % (a[0], a[1])"/>
</t>
</t>
<input t-if="category" type="hidden" name="category" t-att-value="int(category or 0)"/>
@ -280,7 +280,7 @@
<select class="form-control" name="attrib">
<option value=""/>
<t t-foreach="a.value_ids" t-as="v">
<option t-att-value="'%s,%s' % (a.id,v.id)" t-field="v.name" t-att-selected="'selected' if v.id in attrib_set else ''"/>
<option t-att-value="'%s-%s' % (a.id,v.id)" t-field="v.name" t-att-selected="'selected' if v.id in attrib_set else ''"/>
</t>
</select>
</t>
@ -289,7 +289,7 @@
<t t-foreach="a.value_ids" t-as="v">
<li t-att-class="'active' if v.id in attrib_set else ''">
<label style="margin: 0 20px;">
<input type="checkbox" name="attrib" t-att-value="'%s,%s' % (a.id,v.id)" t-att-checked="'checked' if v.id in attrib_set else ''"/>
<input type="checkbox" name="attrib" t-att-value="'%s-%s' % (a.id,v.id)" t-att-checked="'checked' if v.id in attrib_set else ''"/>
<span style="font-weight: normal" t-field="v.name"/>
</label>
</li>
@ -302,7 +302,7 @@
t-attf-class="css_attribute_color #{'active' if v.id in attrib_set else ''}">
<input type="checkbox"
name="attrib"
t-att-value="'%s,%s' % (a.id,v.id)"
t-att-value="'%s-%s' % (a.id,v.id)"
t-att-checked="'checked' if v.id in attrib_set else ''"
t-att-title="v.name"/>
</label>