跳至內容
選單
此問題已被標幟
1 回覆
8809 瀏覽次數

I have to modify the xpath of Odoo module in my custom module. Consider below this code of website_sale module of V11 (For simplicity, i have reduced code):

<template id="recommended_products" inherit_id="website_sale.product" customize_show="True" name="Alternative Products">
    <xpath expr="//div[@id='product_full_description']" position="after">
        <div class="container mt32" t-if="product.alternative_product_ids">
            <h3>Alternative Products:</h3>                                        
        </div>
    </xpath>
</template>

For example, I want to replace

1) position="after" to position="before"

OR

2) expr="//div[@id='product_full_description']" to expr="//div[@id='product_small_description']"

How can i do this?

頭像
捨棄

Inheritance in model and views in Odoo: https://goo.gl/4Zyc9d

最佳答案

you can override template. for eg:

<template id="module_name.recommended_products" inherit_id="website_sale.product" customize_show="True" name="Alternative Products">
......
......
your codes
..
</template>

overriding needs external_id followed by module name. you can also give a priority attribute.

頭像
捨棄

Many thanks!! works for me :)

相關帖文 回覆 瀏覽次數 活動
0
1月 24
39
2
10月 23
5214
2
3月 24
1639
1
6月 19
8869
1
7月 18
7957