how can I get the current date with the correct timezone of the user printing the report?
I am using this, but this brings the current UTC time.
<span t-esc="time.strftime('%Y-%m-%d %H:%M:%S')"/>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
how can I get the current date with the correct timezone of the user printing the report?
I am using this, but this brings the current UTC time.
<span t-esc="time.strftime('%Y-%m-%d %H:%M:%S')"/>
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/>
This should be the correct answer
This is the correct answer
context_timestamp().strftime('%Y-%m-%d %H:%M') gives 'NoneType' object is not callable
error in odoo 14 with dt.dt.now() or with a datetime field or without parameter :(
Thanks a lot brother, this is the best answer
I have just created a module which allows you do to:
<span t-usertime="%Y-%m-%d %H-%M-%S" />
and get the correct timezone. See it on GitHub
This has now been accepted in the OCA addons. Updated the github link.
Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!
Registrieren| Verknüpfte Beiträge | Antworten | Ansichten | Aktivität | |
|---|---|---|---|---|
|
1
Juli 25
|
3200 | |||
|
1
Mai 25
|
4154 | |||
|
1
Apr. 25
|
3422 | |||
|
1
Feb. 25
|
2829 | |||
|
0
Okt. 24
|
2298 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.