Last active
June 5, 2020 04:25
-
-
Save aek/d8a3588e1f8c63f96be242f4d6d75b09 to your computer and use it in GitHub Desktop.
Example of an Odoo Template XML rewrite using rare and non-documented inheritance extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<odoo> | |
<template id="recommended_products_ext" inherit_id="website_sale.recommended_products"> | |
<xpath expr="." position="replace"> | |
<t name="Product" t-name="website_sale.recommended_products"> | |
<xpath expr="//div[@id='product_small_description']" position="before"> | |
<div class="container mt32" t-if="product.alternative_product_ids"> | |
<h3>Alternative Products:</h3> | |
<div class="row mt16" style=""> | |
<t t-foreach="product.alternative_product_ids" t-as="alt_product"> | |
<div class="col-md-2 thumbnail" style="width: 170px; height:130px; float:left; display:inline; margin-right: 10px; overflow:hidden;"> | |
<div class="mt16 text-center" style="height: 100%;"> | |
<div t-field="alt_product.image_small" t-options="{'widget': 'image', 'class': 'img-rounded shadow o_alternative_product' }" /> | |
<h5> | |
<a t-attf-href="/shop/product/#{ slug(alt_product) }" style="display: block"> | |
<span t-att-title="alt_product.name" t-field="alt_product.name" class="o_text_overflow" style="display: block;" /> | |
</a> | |
</h5> | |
</div> | |
</div> | |
</t> | |
</div> | |
</div> | |
</xpath> | |
</t> | |
</xpath> | |
</template> | |
</odoo> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment