Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
3 Antworten
7317 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Autor Beste Antwort

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
Verwerfen

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>

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Juli 25
1987
1
Mai 25
2118
1
Apr. 25
2497
1
Feb. 25
1778
0
Okt. 24
1515