[IMP] website_sale: some change for attributes

bzr revid: chm@openerp.com-20131107162101-82tl3ibbhxkbgjro
This commit is contained in:
Christophe Matthieu
2013-11-07 17:21:01 +01:00
parent 777a4ba2c2
commit 4ff0a207f6
3 changed files with 53 additions and 19 deletions
@@ -38,7 +38,7 @@ class attributes(osv.Model):
_columns = {
'name': fields.char('Name', size=64, translate=True, required=True),
'type': fields.selection([('distinct', 'Distinct'), ('float', 'Float')], "Type", required=True),
'type': fields.selection([('distinct', 'Textual Value'), ('float', 'Numeric Value')], "Type", required=True),
'value_ids': fields.one2many('product.attribute.value', 'attribute_id', 'Values'),
'product_ids': fields.one2many('product.attribute.product', 'attribute_id', 'Products'),
@@ -48,7 +48,7 @@ class attributes(osv.Model):
'float_min': fields.function(_get_float_min, type='float', string="Min", store={
'product.attribute.product': (_get_min_max, ['value','attribute_id'], 20),
}),
'visible': fields.boolean('Visible'),
'visible': fields.boolean('Display Filter on Website'),
}
_defaults = {
'type': 'distinct',
@@ -65,9 +65,10 @@ class attributes_value(osv.Model):
class attributes_product(osv.Model):
_name = "product.attribute.product"
_order = 'attribute_id, value_id, value'
_columns = {
'value': fields.float('Value'),
'value_id': fields.many2one('product.attribute.value', 'Distinct Value'),
'value': fields.float('Numeric Value'),
'value_id': fields.many2one('product.attribute.value', 'Textual Value'),
'attribute_id': fields.many2one('product.attribute', 'Attribute', required=True),
'product_id': fields.many2one('product.template', 'Product', required=True),
+33 -13
View File
@@ -272,7 +272,7 @@
<section class="container oe_website_sale mb16" id="product_detail">
<div class="row">
<div class="col-sm-7 col-md-7 col-lg-7">
<span t-field="product.image" style="max-height: 500px" t-field-options='{"widget": "image"}'/>
<span t-field="product.image" style="max-height: 500px" t-field-options='{"widget": "image", "class": "img img-responsive"}'/>
</div><div class="col-sm-5 col-md-5 col-lg-4 col-lg-offset-1">
<h1 t-field="product.name">Product Name</h1>
@@ -345,6 +345,26 @@
</xpath>
</template>
<template id="product_attributes" inherit_option_id="website_sale.product" name="Product Attributes">
<xpath expr="//div[@id='product_full_description']" position="after">
<div class="container">
<h3>Datasheet</h3>
<table>
<t t-foreach="product.website_attribute_ids" t-as="attribute">
<tr t-if="attribute.attribute_id.type == 'distinct'">
<th><span t-field="attribute.attribute_id"/></th>
<td><span t-field="attribute.value_id"/></td>
</tr>
<tr t-if="attribute.attribute_id.type == 'float'">
<th><span t-field="attribute.attribute_id"/></th>
<td><span t-field="attribute.value"/></td>
</tr>
</t>
</table>
</div>
</xpath>
</template>
<!-- Page Shop my cart -->
<template id="mycart" name="Your Cart">
@@ -365,18 +385,6 @@
</ul>
<h1 class="mb32">Shopping Cart</h1>
<div class="row">
<div class="col-md-3 text-muted" id="right_column">
<h4>Policies</h4>
<ul class="list-unstyled mb32">
<li>&#9745; 30-days money-back guarantee</li>
<li>&#9745; Invoice sent by e-Mail</li>
</ul>
<h4>Secure Payment</h4>
<ul class="list-unstyled mb32">
<li>&#9745; 256 bit encryption</li>
<li>&#9745; Processed by Ogone</li>
</ul>
</div>
<div class="col-md-8 col-md-offset-1 oe_mycart">
<div t-if="not website_sale_order or not website_sale_order.order_line" class="well well-lg">
Your cart is empty!
@@ -470,6 +478,18 @@
<a t-if="website_sale_order and website_sale_order.order_line" t-href="/shop/checkout/" class="btn btn-primary pull-right mb32">Process Checkout <span class="icon-long-arrow-right"/></a>
<div class="oe_structure"/>
</div>
<div class="col-md-3 text-muted" id="right_column">
<h4>Policies</h4>
<ul class="list-unstyled mb32">
<li>&#9745; 30-days money-back guarantee</li>
<li>&#9745; Invoice sent by e-Mail</li>
</ul>
<h4>Secure Payment</h4>
<ul class="list-unstyled mb32">
<li>&#9745; 256 bit encryption</li>
<li>&#9745; Processed by Ogone</li>
</ul>
</div>
</div>
</div>
@@ -64,7 +64,7 @@
<field name="website_published"/>
</xpath>
<xpath expr="//page[@string='Information']" position="inside">
<group colspan="4" string="Products On Ecommerce">
<group colspan="4" string="Website Options">
<field name="suggested_product_ids" widget="many2many_tags"/>
<field name="website_style_ids" widget="many2many_tags"/>
<field colspan="4" name="website_attribute_ids" nolabel="1">
@@ -81,9 +81,22 @@
</group>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="view_product_attribute_form">
<field name="name">product.attribute.form</field>
<field name="model">product.attribute</field>
<field name="arch" type="xml">
<form string="Product Attributes" version="7.0">
<group>
<field name="name"/>
<field name="type"/>
<field name="visible"/>
</group>
</form>
</field>
</record>
</data>
</openerp>