Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
111 Vistas

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
Descartar
Autor

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

Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 25
892
2
ago 25
410
2
ago 25
485
3
ago 25
1291
1
ago 25
696