Odoo Help

Welcome!

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.

0

Wrong date format on PDF of invoice

By
Fotis Dimanidis
on 1/8/15, 10:52 AM 2,591 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..

Yenthe
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!

Yenthe
on 1/9/15, 10:01 AM
1

Yenthe

--Yenthe--
6716
| 7 7 8
Turnhout, Belgium
--Yenthe--

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

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

Yenthe
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.

 

0
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.

Yenthe
on 1/9/15, 11:40 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

3 follower(s)

Stats

Asked: 1/8/15, 10:52 AM
Seen: 2591 times
Last updated: 11/6/16, 3:55 AM