Search Here

Get Selection field value instead of key in Odoo

In this article you will learn how to retrieve Selection field value in python instead of its key. For example you have a selection field which have values like [('a', 'A'), ('b','B'), ('c','C')].  

Retrieving Selection Field value instead of key

Retrieving Selection Field value instead of key

code = fields.Selection([('a', 'A'), ('b','B'), ('c','C')])

If you get this field value in python its gives "a" instead of "A". To get actual value we will use below code snippet.

Method 1:

Method 2:

Post a Comment

0 Comments