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

2.1k views Asked by At

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

1

There are 1 answers

2
CZoellner On

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" />