March 2018
Beginner to intermediate
336 pages
8h 22m
English
For historical reasons, ORM recordsets handle date and datetime values using their strings representations, instead of actual Python Date and Datetime objects:
They map to %Y-%m-%d and %Y-%m-%d %H:%M:%S respectively. In the database, they are stored in date fields, but datetimes are stored without time zone, in UTC time.
To help handle dates, fields.Date and fields.Datetime provide a few functions, for example:
>>> from odoo import fields
>>> fields.Datetime.now()
'2017-11-21 23:11:55'
>>> fields.Datetime.from_string('2017-11-21 23:11:55')
datetime.datetime(2017, 11, 21, 23, 11, 55)
Dates and times are handled and stored by the server ...
Read now
Unlock full access