Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the value of the selection field other than the key in q-web reports odoo 12?

Tags:

qweb

odoo-12

I have a selection field like

field = fields.Selection([('a', 'A'), ('b', 'B')],string='Test')

When i tried fetching the selected element in the selection field the key 'a' is getting printed to the pdf, i needs to print the 'A'

<t t-esc="med['field']"/> #med is one2many line connecting model A to the B,i'm trying to fetch the datas from model B(Notebook),

like image 336
Raihan Avatar asked Dec 30 '25 12:12

Raihan


1 Answers

I don't know about older versions, but atleast in Odoo 13.0 just use t-field instead of t-esc so Odoo will get the right value for you. Simple example:

<span t-field="med.field" />

like image 146
CZoellner Avatar answered Jan 01 '26 06:01

CZoellner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!