Compare commits

...

1 Commits

Author SHA1 Message Date
asno-odoo
17ac807d6a [IMP] orm : add info about boolean default
When a default value for boolean is set as False, the values of
new column for existing records is set to NULL. In python, FALSE
and NULL might mean same thing in certain contexts but its not the
case for Sql(we allow to add sql constraints).
2023-12-14 17:09:35 +01:00

View File

@@ -249,6 +249,9 @@ Some attributes are available on all fields, here are the most common ones:
:attr:`~odoo.fields.Field.required` (``bool``, default: ``False``)
If ``True``, the field can not be empty. It must either have a default
value or always be given a value when creating a record.
..note::
For existing records, a boolean field defaulting to ``False`` signifies a null boolean state.
So sql constraints needs to use ``is not True`` instead of ``is False``.
:attr:`~odoo.fields.Field.help` (``str``, default: ``''``)
Provides long-form help tooltip for users in the UI.
:attr:`~odoo.fields.Field.index` (``bool``, default: ``False``)