将序列编号列添加到QWEB报告中



我需要在qweb报告中添加一个序列编号列,例如[so,引号,pos,pos,thriever slip& et et et eff。]。

  <table class="table table-condensed mt48" t-if="not o.move_line_ids">
                    <thead>
                        <tr>
                            <th><strong>Product</strong></th>
                            <th><strong>Ordered Quantity</strong></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                        <td  t-foreach="not o.move_line_ids" t-as="i">
                               <t t-set="i" t-value="1" />
                                <span t-esc="i"/> 
                               <t t-set="i" t-value="i+1"/> 
                          </td>
                            <td><span t-field="move.product_id"/></td>
                            <td>
                                <span t-field="move.ordered_qty"/>
                                <span t-field="move.product_uom"/>
                            </td>
                        </tr>
                    </tbody>
    </table>

可悲的是,我无法使它起作用。它给我一个空的错误。

<t t-set="i" t-value="1" />
<table class="table table-condensed mt48" t-if="o.move_line_ids">
  <thead>
    <tr>
      <th><strong>#</strong></th>
      <th><strong>Product</strong></th>
      <th><strong>Ordered Quantity</strong></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td t-foreach="o.move_line_ids" t-as="move">
        <span t-esc="i"/> 
        <t t-set="i" t-value="i+1"/> 
      </td>
      <td><span t-field="move.product_id.name"/></td>
      <td>
        <span t-field="move.ordered_qty"/>
        <span t-field="move.product_uom"/>
      </td>
    </tr>
  </tbody>
</table>

最新更新