تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2617 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
الكاتب

Thanks, works like a charm!
Andy