1

我在 OpenERP 中创建报告。我使用 RML。

但是现在我被阻止了,我需要使用嵌套的 repeatIn。我已经尝试过了,但它不起作用。

<section>
<blockTable colwidths="150,100,100,100,100,100" style="Table1">
<tr>
<td>
      <para style="P8">NOM EMPLOYÉ</para>
    </td>
    <td>

      <para style="P7">[[ repeatIn(repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'p'),'o') ]]</para>
      <para style="P7">[[ o ]]</para>
    </td>      
  </tr>
</blockTable>

我收到了这个错误:

 2015-09-09 10:54:39,165 6414 ERROR openerp openerp.tools.safe_eval:      Cannot eval "o[ p['name'] ]"
 Traceback (most recent call last):
 File "/opt/openerp/v7/server/openerp/tools/safe_eval.py", line 288, in safe_eval
 return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
 File "", line 1, in <module>
 NameError: name 'p' is not defined
 2015-09-09 10:54:39,166 6414 ERROR openerp openerp.tools.safe_eval: Cannot eval "o[ p['name'] ]"
 Traceback (most recent call last):
 File "/opt/openerp/v7/server/openerp/tools/safe_eval.py", line 288, in safe_eval
return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
 File "", line 1, in <module>
 NameError: name 'p' is not defined
 2015-09-09 10:54:39,166 6414 ERROR openerp openerp.tools.safe_eval: Cannot eval "o[ p['name'] ]"
 Traceback (most recent call last):
 File "/opt/openerp/v7/server/openerp/tools/safe_eval.py", line 288, in safe_eval
return eval(test_expr(expr, _SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
 File "", line 1, in <module>
 NameError: name 'p' is not defined

我不知道怎么做,也没有找到任何例子。

4

1 回答 1

1

终于我得到了答案:)

这是 RML 代码:

<section>
<blockTable colwidths="150,100,100,100,100,100" style="Table1">
<tr>
<td>
      <para style="P8">NOM EMPLOYÉ</para>
    </td>
    <td>
      <para style="P8">MATRICULE</para>
    </td>
    <td>

      <para style="P7">[[ repeatIn(repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'p', 'td'),'o') ]]</para>
      <para style="P7">[[ repeatIn(o['p'], 'line', 'td') ]]</para>
      <para style="P7">[[ line['name'] ]]</para>
      <para style="P7">[[ line['matricule'] ]]</para>
    </td>      
  </tr>
</blockTable>

此致。

于 2015-09-09T13:12:03.290 回答