コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
130 ビュー

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!

アバター
破棄
著作者

Doesn´t work this solution, I opened a ticket and I have to get an 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

アバター
破棄
関連投稿 返信 ビュー 活動
1
8月 25
894
2
8月 25
412
2
8月 25
488
3
8月 25
1292
1
8月 25
697