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?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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="{"format": "dd/MM/YYYY"}"/>
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="{"format": "dd/MM/YYYY"}"/>
You will get a dateformat of d/m/Y in place of m/d/Y.
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"}'/>
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
4
Aug 24
|
70780 | ||
Date format in Dashboard
Solved
|
|
2
Oct 24
|
184 | |
|
0
Oct 23
|
1382 | ||
|
2
Oct 23
|
1270 | ||
|
0
Sep 23
|
530 |
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?
I cannot comment your answer due to limited Karma. Please see my comment above.
@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 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
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!