Base Selection Label

Display formatted value of selection fields

Technical Name:
base_selection_label
License:
Author:
Numigi
Website:
https://kastor.lab.numigi.net/web/image/product.template/940/image_1920?unique=0a81b40
  • Odoo Version

Conditions générales
Garantie satisfait ou remboursé de 30 jours
Expédition : 2-3 jours ouvrables

Base Selection Label

This module allows to display the value of a selection field of any record.

Context

In vanilla Odoo, fields of type Selection are stored as technical strings.

These technical strings are dynamically formatted and translated in the web interface.

However, when you need to display these fields in reports (other than qweb), it gets complicated.

Overview

After installing this module, a new method get_selection_label is added on all models.

The method takes in parameter the technical name of the field to display.

partner = env.ref("base.main_partner")
label = partner.get_selection_label("lang")
print(label)

The above code should print the formatted name of the language of the main partner.

Contributors