Odoo Aide

0

0
7 Answers
4

Hi  David knowles

<sapn t-esc="datetime.datetime.strptime(your field name, '%Y-%m-%d %H:%M:%S').strftime('%d/%m/%Y')"/>

you should to use this code.

Hope this will help you, Thanks!

1
Esther Martín
18/04/2017 10:18

<span t-esc="line['date_maturity']" t-field-options='{"format": "MM/dd/yyyy"}'/>


Change the format to UK format

0
Eugen ȚAGA
14/12/2018 03:02
<span t-esc="datetime.datetime.strptime(your field name, '%Y-%m-%d %H:%M:%S').strftime('%d/%m/%Y')"/>

0
Gael Torrecillas
28/04/2017 04:26

hello,

I work on :

<span t-esc="Date"/>

and I try to change the format, and I use :

Date: <span t-esc="Date.strftime('%d-%m-%Y')" /><br/>

"Date" is a "datetime" object, if yours others dates are "datetime" objects so this solution is the right one.

0
David Knowles
18/04/2017 12:27

Hi Esther,

Thanks for your response, I've already tried that syntax and it does not appear to work.

I thought that t-field-options could only be applied to t-fields and not t-esc?


I also tried your second suggestion and the Odoo 10 (CE) server had the following error:


Error to render compiling AST
TypeError: 'NoneType' object has no attribute '__getitem__'
Template: account.report_overdue_document
Path: /templates/t/t/div/div/div[2]/p/span[2]
Node: <span t-esc="formatLang(line['date_maturity'], date=True)"/>



2 Comments
Esther Martín
18/04/2017 15:04

Try this, the language must be UK

<span t-esc="formatLang(line['date_maturity'], date=True)"/>

David Knowles
19/04/2017 14:38

I also tried your second suggestion and the Odoo 10 (CE) server had the following error:

Error to render compiling AST

TypeError: 'NoneType' object has no attribute '__getitem__'

Template: account.report_overdue_document

Path: /templates/t/t/div/div/div[2]/p/span[2]

Node: <span t-esc="formatLang(line['date_maturity'], date=True)"/>

Poser une question
Keep Informed
1 Abonné(e)s
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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now