diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-04-07 11:14:25 +0000 |
|---|---|---|
| committer | Victor Feyens <vfe@odoo.com> | 2020-04-07 12:11:57 +0000 |
| commit | 57eb96418221176f3d8adb11f4fce0b720edbfa3 (patch) | |
| tree | 038e84e5d7b36212869680b3c67ec4750c1b70ee /doc | |
| parent | a0348ba3bf465c4a112363b539c97aa3fb9aa956 (diff) | |
[IMP] base: document all field types.
closes odoo/odoo#49135
X-original-commit: cc653d3f1a49e2b7b2cc0ec833097bd7cf3528a1
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/reference/orm.rst | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst index 75e073d2b80..ddc5918553b 100644 --- a/doc/reference/orm.rst +++ b/doc/reference/orm.rst @@ -144,22 +144,27 @@ Advanced Fields Date(time) Fields ''''''''''''''''' -Dates and Datetimes are very important fields in any kind of business -application, they are heavily used in many popular Odoo applications such as -logistics or accounting and their misuse can create invisible yet painful -bugs, this excerpt aims to provide Odoo developers with the knowledge required +:class:`Dates <odoo.fields.Date>` and :class:`Datetimes <odoo.fields.Datetime>` +are very important fields in any kind of business application. +Their misuse can create invisible yet painful bugs, this section +aims to provide Odoo developers with the knowledge required to avoid misusing these fields. When assigning a value to a Date/Datetime field, the following options are valid: * A `date` or `datetime` object. -* A string in the proper server format *(YYYY-MM-DD)* for Date fields, - *(YYYY-MM-DD HH:MM:SS)* for Datetime fields. +* A string in the proper server format: + + * ``YYYY-MM-DD`` for :class:`~odoo.fields.Date` fields, + * ``YYYY-MM-DD HH:MM:SS`` for :class:`~odoo.fields.Datetime` fields. + * `False` or `None`. The Date and Datetime fields class have helper methods to attempt conversion -into a compatible type: :func:`~odoo.fields.Date.to_date` will convert to a `datetime.date` -object while :func:`~odoo.fields.Datetime.to_datetime` will convert to a `datetime.datetime`. +into a compatible type: + +* :func:`~odoo.fields.Date.to_date` will convert to a :class:`datetime.date` +* :func:`~odoo.fields.Datetime.to_datetime` will convert to a :class:`datetime.datetime`. .. admonition:: Example |
