跳至內容
選單
此問題已被標幟
2 回覆
15106 瀏覽次數

If I have some calculated value and I want to display it on report.

For example

<t t-set="price_unit" t-value="get_price_unit(l)"/>
<span t-esc="price_unit"/>

The only thing I could use in the previous versions was formatLang, but that is a webkit method and Odoo 10 doesn't have that anymore. Is there any other way to format the number and it's thousands separator in qweb?



頭像
捨棄
最佳答案

I needed to show a thousand separator in a Qweb invoice field and I succeeded with the following  expression

<tr t-foreach="o.invoice_line" t-as="l">
...      <td><span t-esc="'{:,}'.format(l.price_subtotal)"/></td>
</tr>

 

頭像
捨棄
最佳答案

Hi,


Please check this,

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

Thanks
Aswini iWesabe
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
7
8月 19
24804
0
9月 18
4343
0
7月 17
3790
0
3月 17
4673
4
12月 23
43327