Skip to Content
Menu
This question has been flagged
3 Replies
3231 Views

Hello

I have declated a selection field as follows:

type_capture = fields.Selection([('1', 'Capteur de temperature'), ('2', 'Capteur humidite')], string='Type de capture', required=True)


And in my view xml file, i would like to show the image "logo1" if the type_capture == Capteur humidite

<span t-if="record.type_capture == Capteur humidite"> <a type="object"><img src="/affichage/static/src/image/logo1.png" width="100" height="100"/></a></span>

But is not working for me, i don't get any pictures in result. Any help please?

Avatar
Discard
Best Answer

Avatar
Discard
Best Answer

Hello Zakaria, 

in xml you need to check the type capture fields actual value, not display value. see below line and try.

<span t-if="record.type_capture == '1'">
    <a type="object">
        <img src="/affichage/static/src/image/logo1.png" width="100" height="100"/>
    </a>
</span>

Thanks

Avatar
Discard