[IMP] website_sale: optional product + fix forgotten line_id in website_event_sale

This commit is contained in:
Christophe Matthieu 2014-06-17 15:49:48 +02:00
parent 25c564d635
commit 0d9f3af113
4 changed files with 16 additions and 4 deletions

View File

@ -9,7 +9,7 @@ class sale_order(osv.Model):
def _cart_find_product_line(self, cr, uid, ids, product_id=None, line_id=None, linked_line_id=None, optional_product_ids=None, context=None):
for so in self.browse(cr, uid, ids, context=context):
domain = [('order_id', '=', so.id), ('product_id', '=', product_id)]
if line_id:
domain += [('id', '=', line_id)]
@ -29,7 +29,7 @@ class sale_order(osv.Model):
return order_line_id
def _website_product_id_change(self, cr, uid, ids, order_id, product_id, line_id=None, context=None):
values = super(sale_order,self)._website_product_id_change(cr, uid, ids, order_id, product_id, line_id=None, context=None)
values = super(sale_order,self)._website_product_id_change(cr, uid, ids, order_id, product_id, line_id=line_id, context=None)
event_ticket_id = None
if context.get("event_ticket_id"):

View File

@ -6,8 +6,11 @@
<field name="image" type="base64" file="website/static/description/website_edit.png"/>
</record>
<!-- add Warranty to ipad -->
<record id="product_attribute_1" model="product.attribute">
<field name="name">Duration</field>
<field name="type">hidden</field>
</record>
<record id="product_attribute_value_1" model="product.attribute.value">
<field name="name">1 year</field>
@ -45,6 +48,13 @@
<record id="product.product_product_4_product_template" model="product.template">
<field name="optional_product_ids" eval="[(6,0,[ref('product_product_1_product_template')])]"/>
</record>
<record id="product_attribute_price_1" model="product.attribute.price">
<field name="product_tmpl_id" ref="product_product_1_product_template"/>
<field name="value_id" ref="product_attribute_value_2"/>
<field name="price_extra">18.00</field>
</record>
<!-- -->
<record id="product.product_attribute_2" model="product.attribute">
<field name="type">color</field>

View File

@ -202,7 +202,7 @@ class product_product(osv.Model):
class product_attribute(osv.Model):
_inherit = "product.attribute"
_columns = {
'type': fields.selection([('radio', 'Radio'), ('select', 'Select'), ('color', 'Color')], string="Type", type="char"),
'type': fields.selection([('radio', 'Radio'), ('select', 'Select'), ('color', 'Color'), ('hidden', 'Hidden')], string="Type", type="char"),
}
_defaults = {
'type': lambda *a: 'radio',

View File

@ -273,6 +273,7 @@
<input type="hidden" name="search" t-att-value="search"/>
<ul class="nav nav-pills nav-stacked mt16">
<t t-foreach="attributes" t-as="a">
<t t-if="a.type != 'hidden'">
<li t-if="a.value_ids and len(a.value_ids) > 1">
<div><strong t-field="a.name"/></div>
<t t-if="a.type == 'select'">
@ -308,6 +309,7 @@
</t>
</t>
</li>
</t>
</t>
</ul>
</form>
@ -616,7 +618,7 @@
</select>
</t>
<t t-if="variant_id.attribute_id.type == 'radio'">
<t t-if="variant_id.attribute_id.type in ['radio', 'hidden']">
<ul class="list-unstyled">
<t t-set="inc" t-value="0"/>
<t t-foreach="variant_id.value_ids" t-as="value_id">