Skip to Content
Menú
This question has been flagged
3 Respostes
7319 Vistes

I am creating a report and want to add lines to a table. I have a python process that will create a linea with the <td> tags inside. However, this:

<table width="100%">
 <th></th>
 <th class="text-right">Ctd.</th>
 <th class="text-right">Importe</th>
 <t t-foreach="docs.filtra_pedidos(c)" t-as="l">
     <tr t-esc="l"></tr>
 </t>
 </table>

renders into this:



how can I get the <td> inside the <tr>tags?

Avatar
Descartar
Best Answer

You just need to add <td> tag inside the <tr> tag.

Try the following code:

<t t-foreach="docs.filtra_pedidos(c)" t-as="l">
<tr>
<td><span t-esc="l.name"/></td>
<td><span t-esc="l.partner_id.name"/></td>
<td><span t-esc="l.note"/></td>
</tr>
 </t>


Avatar
Descartar
Autor Best Answer

let me clarify, this is the content of each "l":

['<td colspan="2">S00007</td><td>0.0</td>']

In each case it´s different, so if I add the <td> tag, it will just paste the text inside a cell, not a whole row.


Avatar
Descartar

You will have to add every field you want in the report in <td> tag.

Ex:

<td> <span t-esc="l.name"> </td>

<td> <span t-esc="l.partner_id.name"> </td>

<td> <span t-esc="l.note"> </td>

Related Posts Respostes Vistes Activitat
1
de jul. 25
1987
1
de maig 25
2120
1
d’abr. 25
2497
1
de febr. 25
1778
0
d’oct. 24
1515