Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
8914 มุมมอง

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 :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 24
39
2
ต.ค. 23
5354
2
มี.ค. 24
1739
1
มิ.ย. 19
9032
1
ก.ค. 18
8082