Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
843 Переглядів

Hello,


I am working with a Boolean field in Odoo and trying to use it in a group-by operation. However, I noticed that when the field is NULL in the database, Odoo automatically treats it as `False` when grouping records.


Expected Behavior:

-True → Grouped as "True"

- False → Grouped as "False"

- NULL (Undefined) → Should be grouped as "Undefined"


### Actual Behavior:

True → Grouped as "True"

False → Grouped as "False"

NULL → Also grouped as "False" instead of "Undefined"


It seems like Odoo's ORM considers `NULL` as `False`, which causes all uninitialized records to appear in the "No" group.


My Questions:

1. How can I make Odoo show an "Undefined" category for NULL values in a Boolean field?

2. Is there a built-in way to handle this in the ORM or do I need a computed field?

3. Any best practices for handling Boolean fields in grouping?


I am using **Odoo11 Enterprise**.


Any help would be appreciated. Thanks!


Аватар
Відмінити
Автор

But I am able to store NULL, True, and False values in the database. Why can't we display this in Odoo's group-by UI?

Because we do not support null booleans (the are always False). This was a design decision because only very technical Users understand null AND there is no way to display NULL to Users.

Автор

yeah! thanks for your confirmation Ray!

Найкраща відповідь

Odoo does not support null booleans (they are always False).

You will need another field type.

Boolean by definition has two values: True and False.

You are asking for three values which is not an Odoo boolean field type.


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
квіт. 21
3941
2
лип. 21
6203
1
січ. 20
4918
5
груд. 18
28615
3
січ. 23
29434