Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to inherit and replace a inherited template in website_sale?

on 12/15/15, 12:06 AM 785 views

Hi all,

Here i want inherit and replace a inherited template in a separate folder, i want inherit the below code. and its located in addons/website_sale/views/templates.xml

<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">

<a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/>


<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))"/>




Thanks in advance......

Oscar Alcala
On 12/15/15, 1:11 AM
<template id="website_sale.products_add_to_cart" inherit_id="website_sale.products_add_to_cart" active="False" customize_show="True"></template>

This will completely delete the origin template, not recommended instead I recommend to you to use a different id and modify inside whatever you want.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 12/15/15, 12:06 AM
Seen: 785 times
Last updated: 12/15/15, 1:11 AM