it uw
it uw

Reputation: 11

How to convert float to int in odoo qweb?

i need help about odoo. i want to convert float to int in Odoo14 qweb.

 <tr class="border-black">
                                        <td>
                                            <strong>Total Mesin Jalan</strong>
                                        </td>
                                        <td class="text-right">
                                            <span t-value="int(doc.total_mesin_jalan)"/> %%
                                        </td>
                                    </tr>
                                    <tr class="border-black">
                                        <td>
                                            <strong>Presentasi Total</strong>
                                        </td>
                                        <td class="text-right" style="background-color: #3498DB; color: #fff !important;">
                                            <span t-value="int(doc.presentasi_total)"/> %%
                                        </td>
                                    </tr>

im using this method but still not working, and there's nothing show in odoo report it only show the %

Upvotes: -2

Views: 198

Answers (1)

Yassir Irfan
Yassir Irfan

Reputation: 1210

<tr class="border-black">
   <td>
      <strong>Total Mesin Jalan</strong>
   </td>
   <td class="text-right">
      <span t-esc="int(doc.total_mesin_jalan)"/>
   </td>
</tr>
<tr class="border-black">
   <td>
      <strong>Presentasi Total</strong>
   </td>
   <td class="text-right" style="background-color: #3498DB; color: #fff !important;">
      <span t-esc="int(doc.presentasi_total)"/>
   </td>
</tr>

Use t-esc instead of t-value inside a span tag.

Upvotes: 1

Related Questions