コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
7330 ビュー

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?

アバター
破棄
最善の回答

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>


アバター
破棄
著作者 最善の回答

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.


アバター
破棄

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>

関連投稿 返信 ビュー 活動
1
7月 25
1991
1
5月 25
2131
1
4月 25
2498
1
2月 25
1782
0
10月 24
1517