How to format Qweb variables in Odoo

Viewed 7767

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.

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.?

2 Answers

Try below code,

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

Hope it will help you.

Related