Odoo Help


Wrong date format on PDF of invoice

Fotis Dimanidis
on 1/8/15, 10:52 AM 4,211 views

While my date format settings for the corresponding (and every) language are "%d/%m/%Y" in PDF export (aka print) it is always "%m/%d/%Y". How can I fix this?

Thank you Yenthe for your answer. I do not want to hardcode it since I have customers in the US so I want the date format to follow the language of the customer. Isn't this supposed to be the default behavior?

Fotis Dimanidis
on 1/8/15, 11:11 AM

I cannot comment your answer due to limited Karma. Please see my comment above.

Fotis Dimanidis
on 1/8/15, 11:13 AM

@Fotis hmm yes I don't like it hardcoded either. The default behaviour *should* be that the report takes the dateformat that you chose as language but this doesn't seem to be the case. You could open a report for this at https://github.com/odoo/odoo/issues/ with some luck they'll fix it..

on 1/9/15, 1:57 AM

Yenthe I have tried both your suggestions and none seemed to work for me. I remind that I need the edit in invoice PDFs. i tried changing both sale.report_saleorder_document and account.report_invoice_document qweb templates but it had no effect. I have filed a bug report: https://github.com/odoo/odoo/issues/4618

Fotis Dimanidis
on 1/9/15, 9:58 AM

Have you tried this with an invoice that existed before you modified or after you've modified the QWeb? An invoice lay-out never changes after it has been created.. not even if you changed the QWeb so my guess is you didn't make a new invoice after you changed the dateformat on the QWeb template. And good that you created a report for this!

on 1/9/15, 10:01 AM


| 8 8 8

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

On 1/8/15, 10:56 AM

Hi Fotis

To fix this you have two options.
The first is to go to settings > Reports, find the correct QWeb report and open it. Modify the line <p t-field="o.date_order"/> here to <p t-field="o.date_order" t-field-options="{&quot;format&quot;: &quot;dd/MM/YYYY&quot;}"/>

The second option is to do it permanently (also when you update your module) by modifying the XML file for the report where the dateformat is wrong.
For example on a sale order you will see this in the code: (report_saleorder.xml under /addons/sale/views/)

<p t-field="o.date_order">

If you then modify it like this:

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

You will get a dateformat of d/m/Y in place of m/d/Y.


Xabier Arrabal Amat
On 2/20/18, 2:13 PM

The best solution to keep the date localization is to do the following:

<p t-field="o.your_datetime_field" t-field-options='{"widget": "date"}'/>

Fotis Dimanidis
On 1/9/15, 11:32 AM

Turns out this issue happens only to existing invoices. New invoice dates seem to be fine after changing date format settings. I have updated my github issue description to include this improvement for existing invoices as well.

This is not a bug or an error. Changing an approved invoice is technically even illegal as it is an official and finale document.

on 1/9/15, 11:40 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 1/8/15, 10:52 AM
Seen: 4211 times
Last updated: 2/20/18, 2:13 PM