如何在Odoo 10 QWeb报告中格式化日期?

5 qweb odoo-10

t字段选项不起作用。

我试过了

<span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>
Run Code Online (Sandbox Code Playgroud)

Per*_*ino 5

而不是使用

<span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>
Run Code Online (Sandbox Code Playgroud)

使用

<span t-field="o.date_invoice" t-options='{"format": "MM/dd/yyyy"}'/>
Run Code Online (Sandbox Code Playgroud)

希望有帮助!


小智 0

尝试这个。

<span t-esc="datetime.datetime.strptime(o.sale_id.confirmation_date, '%Y-%m-%d %H:%M:%S').strftime('%B %d,%Y')"/>
Run Code Online (Sandbox Code Playgroud)

我的输出是:2018年5月28日