[FIX] website_sale, website_sale_options: optional_product_ids

The field optional_product_ids is not in the model "product.template" if
the module website_sale_options is not installed.

opw:654273
This commit is contained in:
Goffin Simon 2015-11-13 13:05:33 +01:00
parent afae197073
commit 26189bf67a
2 changed files with 11 additions and 2 deletions

View File

@ -116,10 +116,10 @@
<template id="products_add_to_cart" inherit_id="website_sale.products_item" active="False" customize_show="True" name="Add to Cart">
<xpath expr="//div[@class='product_price']" position="inside">
<input name="product_id" t-att-value="product.product_variant_ids[0].id" type="hidden"/>
<t t-if="len(product.product_variant_ids) == 1 and not len(product.optional_product_ids) &gt;= 1">
<t t-if="len(product.product_variant_ids) == 1">
<a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>
</t>
<t t-if="len(product.product_variant_ids) &gt; 1 or len(product.optional_product_ids) &gt;= 1">
<t t-if="len(product.product_variant_ids) &gt; 1">
<a class="btn btn-default btn-xs fa fa-shopping-cart" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"/>
</t>
</xpath>

View File

@ -145,5 +145,14 @@
</div>
</template>
<template id="products_add_to_cart" inherit_id="website_sale.products_add_to_cart">
<xpath expr="//div[@class='product_price']/t[1]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) == 1 and not len(product.optional_product_ids) &gt;= 1</attribute>
</xpath>
<xpath expr="//div[@class='product_price']/t[2]" position="attributes">
<attribute name="t-if">len(product.product_variant_ids) &gt; 1 or len(product.optional_product_ids) &gt;= 1</attribute>
</xpath>
</template>
</data>
</openerp>