Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2608 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor

Thanks, works like a charm!
Andy