在odoo电子邮件模板中格式化日期 [英] Formatting date in odoo email template
本文介绍了在odoo电子邮件模板中格式化日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在odoo 9中,我需要在电子邮件模板中以%d/%m/%Y格式设置date_invoice:
In odoo 9 i need to format the date_invoice in %d/%m/%Y inside email template:
Invoice date: ${object.date_invoice}
上面的代码返回2017-03-31,但是它的语言环境不正确.
The code above return 2017-03-31 but it is in wrong locale.
我如何格式化才能获得31/03/2017?
How i can format to get 31/03/2017 ?
推荐答案
您可以使用其他替代方法来实现.
You can achieve using alternative different way.
$ {object.date_invoice和object.date_invoice.split('-')[1] +'/'+ object.date_invoice.split('-')[2] +'/'+对象. date_invoice.split('-')[0]或''}
这篇关于在odoo电子邮件模板中格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文