Technical mailing list archives

technical@mail.odoo.com

Avatar

Re: mail template (jinja2) - date format - month in french.

by
Krupesh Laiya
- 06/23/19 17:16:40
Hello,
Use function to convert date and add converted date to context and access that context in template by ctx.get('converted_date')

On Sat, Jun 22, 2019, 9:31 AM Yves Goldberg <yves@ygol.com> wrote:
Hello,
I need to insert a date in a mail template.

Using ${object.start_date} ----> 2019-10-30

I can get the required timezone format with:

${format_tz(object.start_date,'Europe/Paris','%d %B %Y')} ----> which give me "30 January 2019"


but the month is in English "January" and I would need it in french "Janvier".

In odoo code this use case is documented and I thought that using 
${format_tz(object.start_date, context={'use_babel': True, 'lang':'fr_FR'})}

would do it but it is not.

Can you point me to some existing example and/or documentation?

Thank you





--
Yves Goldberg
--

_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

Reference