I've added a custom selection field in my module and I'd like to show a little icon depending on what is selected. I got all the icons showing up and the selection field working as expected, but the problem comes when I try and show only one icon at a time. Here's the code:
<span>
<span t-if="record.order_type == 'delivery'" class="fa fa-bus"></span>
<span t-if="record.order_type == 'store'" class="fa fa-cart-arrow-down"></span>
<span t-if="record.order_type == 'online'" class="fa fa-laptop"></span>
</span>
Traceback:So it looks like order_type is undefined on the model. However, this is a field that I added, so I know it exists.TypeError: Cannot read property 'value' of undefined
at Engine.eval (eval at _render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4426:73), <anonymous>:181:32)
at Engine._render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4425:296)
at Engine.render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4425:151)
at Engine._render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4429:57)
at Engine.render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4425:151)
at Class._render (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/606-2e24acc/web.assets_backend.js:2489:561)
at Class.start (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/606-2e24acc/web.assets_backend.js:2481:1273)
at Class.prototype.<computed> [as start] (https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4619:488)
at https://tfqoc-lumeprep2-customerflow-2129849.dev.odoo.com/web/content/534-fa1f61a/web.assets_common.js:4950:52
at async Promise.all (index 1)
I tried adding a t-if on the parent <span> with just "record.order_type" and nothing showed up at all.
So after trying all that, I'm left with one question: How do I access/check field values on my model with t-if?