Lets see some methods in selection fields
console_output = fields.Selection(
[
('console', 'Console'), #Consola
('screen', 'Screen'), #Pantalla
('both', 'Both') #Ambos
], string="Console Output"
)
The original descriptions (Console, Screen...) can be retrieved with the selection property
self._fields['console_output'].selection
this returns a tuple of values
[('console', 'Console'), ('screen', 'Screen'), ('both', 'Both')]
is most useful with dict()
dict(self._fields['console_output'].selection)
returns
{'console': 'Console', 'screen': 'Screen', 'both': 'Both'}
To retrieve the values translated as seen in the front use get_description() method.
This method have all information of the field. The self.env is needed to translate the field label
self._fields['console_output'].get_description(self.env)
returns
{'type': 'selection', 'change_default': False, 'company_dependent': False, 'depends': (), 'manual': False, 'readonly': False, 'required': False, 'searchable': True, 'selection': [('console', 'Consola'), ('screen', 'Pantalla'), ('both', 'Ambos')], 'sortable': True, 'store': True, 'string': 'Salida por Consola'}
then, will use the selection key as dict to retrieve the value translated, so
field_info = dict(self._fields['console_output'].get_description(self.env))
field_selection = dict(field_info.get('selection'))
field_label = field_selection.get(self.console_output)
Hope this will helps: https://learnopenerp.blogspot.com/2021/08/get-selection-field-value-instead-of-key-odoo.html