Skip to Content
Menu
This question has been flagged
1 Odpoveď
159 Zobrazenia

I have a problem with the date when I realized a book of a room in Odoo. When I am going to do a book, in my form I can select a date with an specific hour, for example:

Start date: 18/08/2025 13:00:00
Finish date: 18/08/2025 13:00:00

But I created an email with the date, and I recived a wrong hours, I think that it is because the timezone is diferent in server and here, but I don´t know how to solve this.
The email received have this:

Hola ssss,

Gracias por tu reserva. Te confirmamos que tu reserva de Sala Talavera se ha efectuado con éxito.

Detalles de la reserva:

  • Sala: Sala Talavera
  • Fecha: 18/08/2025 11:00:00 a 18/08/2025 13:00:00
  • Reservado por: ssss

Si necesitas modifcar o cancelar la reserva, por favor contáctanos con antelación al equipo de IT.

Saludos de parte de todo el equipo!



Please, if someone can help me, I appreciate it a lot!

Avatar
Zrušiť
Autor

Doesn´t work this solution, I opened a ticket and I have to get an answer

Best Answer

Hi,


    Odoo stores all datetimes in UTC in the database.


    The user interface converts those datetimes to the user’s timezone (set in their preferences).


    When you send an email and directly insert a datetime field (e.g. ${object.start_date}), Odoo sends the raw UTC value unless you explicitly format it.


    That’s why you see a “wrong” hour in the email — it’s showing UTC, not your local timezone.


You need to format the datetime with timezone conversion in the email template.

Try the code,

            ${format_datetime(object.start_date, tz=user.tz, dt_format="%d/%m/%Y %H:%M")}



Hope it helps

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
aug 25
916
2
aug 25
423
2
aug 25
497
3
aug 25
1311
1
aug 25
716