This question has been flagged
3 Replies
4684 Views

I need to get a date's month name in a given language? Having 'start_date', when using

> ${format_tz(object.start_date,'Europe/Paris','%d %B %Y')}.

I get: 30 January 2019.

I need: 30 Janvier 2019.


This doesn' seem to work: 

> ${format_tz(object.start_date,'Europe/Paris','%d %B %Y', context={'use_babel': 1, 'lang':fr_FR})}

In \https://github.com/odoo/odoo/commit/94da36923139386eee30d3080675f5160f888bf8

it is written: "If a user absolutely want this, he has to add the call to `format_date` himself, manually."

I could'nt find any example in odoo.

Is there a way to call format_date directly in jinja2 and passing the desired language setting?

TIA


Avatar
Discard
Author Best Answer

Hi Thayif. the problem I have is that the context is not taken into account. 

As per the example, the tz setting is ok.

Avatar
Discard