如何在 Odoo 中格式化 Qweb 变量 [英] How to format Qweb variables in Odoo

查看:91
本文介绍了如何在 Odoo 中格式化 Qweb 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在用逗号分隔的 qweb 中显示计算变量.

I have been trying to display a calculated variable in qweb separated by comma's.

<td align="right">
                      <t t-set="total" t-value="0"/>
                          <t t-foreach="l.invoice_line_tax_id" t-as="t">
                          <t t-set="total" t-value="total + (t.amount * 
l.price_subtotal)" />
                          </t>
                          <span t-esc="'%.2f'%(l.price_subtotal + total)"/>

                </td>

-

此行显示带小数点的值,而小数点前的数字不以逗号分隔.

This line displays the values with decimal points, whereas the digits before decimal is not separated by comma's.

例如,上面的代码会将值显示为 400000.00 而我希望它是 4,00,000.00

For example, the above code would display value as 400000.00 whereas I would like it to be 4,00,000.00

有人对此有任何想法吗?

Anyone with any idea on this.?

推荐答案

试试下面的代码,

<span><t t-esc="'{0:,.2f}'.format(inv_value)"/></span>

希望能帮到你.

这篇关于如何在 Odoo 中格式化 Qweb 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆