Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2616 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

Thanks, works like a charm!
Andy