Friday, 23 January 2015

How to replace kanban image using XPATH in Odoo?

We take an example for Partner Object like either partner has checked with Is a Company than we will show the different image or already uploaded image will show.

In Customer Form has field  " " based on it, we will show image in kanban view.

For that we only need to put .xml code.

Here is code:

<record model="ir.ui.view" id="res_partner_kanban_view_extened">
    <field name="name">res.partner.kanban.view.extened</field>
    <field name="inherit_id" ref="base.res_partner_kanban_view"/>
    <field name="model">res.partner</field>
    <field name="arch" type="xml">
        <xpath expr='//kanban/templates/t/div/a/t/t[@t-if="record.is_company.raw_value === true"]' position="replace">
        <!-- check condition weather IS A COMPANY is checked or not -->
            <t t-if="record.is_company.raw_value === true">
                <img  src="custom_patht_of_image" class="oe_kanban_image"/>
            </t>
        </xpath>
    </field>
</record>

I hope you like this article. Share your views to improve content. Happy Learning !!!

Youtube Video 

1 comment:

ImportError: cannot import name 'utils' from 'PyPDF2'

Odoo 15: Traceback (most recent call last):   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner     self...