Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
2615 Weergaven

Hello,
I added a selection field to my table to indicate the related entity is blocked. The first value should be an empty value, meaning 'not blocked'

blocked = fields.Selection(
string='Blocked',
selection=[(' ',' '), ('payment','Payment'), ('all','All')])

When I put this field on a page, the first value is displayed twice in the dropdown. If I capitalize the other 2 values, then all are displayed twice. It seems that both values in the tulip are displayed if they are the same?

How can I use the selection where the values in the tulip are the same? I'm using ODOO 17.

Thx in advance

Andy

Avatar
Annuleer
Beste antwoord

Hi,

You can achieve this by keeping the two selections only and making them not required with no default value, the user will have to actively select one of the options.

This way, the user can choose between 'Payment', 'All', or leave the field blank ('Not Blocked').

blocked = fields.Selection(
    string='Blocked',
    selection=[('payment', 'Payment'), ('all', 'All')],
)

Hope this will help you

Thanks

Avatar
Annuleer
Auteur

Thanks, works like a charm!
Andy