Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How can I format date in Odoo 8 QWeb report?

César Bustíos Benites
on 11/21/14, 10:54 AM 9,892 views

The date in my Sales Order is currently showing as:

Fecha: 21/11/2014 16:59:15

I want to show something like this:

Fecha: Surco, 21 de Noviembre del 2014

I tried using t-esc with strftime but that doesn't work:

<span t-esc="o.date_order.strftime('%Y')" />

Sajin Aziz
On 11/22/14, 3:50 AM

try this , change date format as required , refer: Python Standard Library - time , 

<span t-esc="time.strftime(''%A, %d %B %Y'',time.strptime(o.date_order,'%Y-%m-%d %H:%M:%S'))"/>

Thank you @Sajin, I'm getting "Uncaught SyntaxError: Unexpected end of input"

César Bustíos Benites
on 11/24/14, 10:10 AM

Sorry, my bad. This is the correct answer :-)

César Bustíos Benites
on 11/24/14, 10:12 AM

Although I'm using Spanish as my language, I'm getting this: "Surco, 21 de November del 2014". How can I make months show in Spanish?

César Bustíos Benites
on 11/24/14, 10:15 AM

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
| 5 3 6
Gandhinagar, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 1/23/15, 2:12 AM

Hello Cesar Bustios Benites

try this code may be helpfull.

<span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>

also use this code

<span t-field="o.date_order" t-field-options="{&quot;format&quot;: &quot;yyyy-MM-dd&quot;}" />

if you find this answer helpful, please give me a thumbs up vote


Ankit H Gandhi


Kelly Stuart
On 11/22/14, 3:09 AM

Hi César. If you are getting an error, please specify what error it is. Otherwise I'm going to assume that your date format is merely incomplete. Try this:

<span t-esc="o.date_order.strftime('%A, %d de %B del %Y')" />

Hello @Kelly, thank you for your answer. Yes I'm getting an error: "Uncaught SyntaxError: Unexpected end of input"

César Bustíos Benites
on 11/24/14, 10:07 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 11/21/14, 10:54 AM
Seen: 9892 times
Last updated: 6/16/16, 2:19 AM