The new method is finally called "context_today" to clearly indicate that it will work using the session context.
It was added in server trunk at revision [1] and the main places in addons that should use it were updated at revision [2].
This also leaves an easy path for fixing related minor cases in the future.
PS: no similar method fields.datetime.context_now was created because datetime values behave as expected when computed in server time, so it is better to use the existing UTC-based fields.datetime.now (also usable for _defaults)
The new method is finally called "context_today" to clearly indicate that it will work using the session context.
It was added in server trunk at revision [1] and the main places in addons that should use it were updated at revision [2].
This also leaves an easy path for fixing related minor cases in the future.
Using it as a _defaults initializer is very easy:
_ defaults = { date.context_ today,
'date_field': fields.
}
No need to import time or use a lambda anymore...
Thanks everyone who provided feedback!
PS: no similar method fields. datetime. context_ now was created because datetime values behave as expected when computed in server time, so it is better to use the existing UTC-based fields.datetime.now (also usable for _defaults)
[1] server trunk r.4050 rev-id: <email address hidden>
[2] addons trunk r.6565 rev-id: <email address hidden>