This question has been flagged
3 Replies
2762 Views

Hello everyone!!!

I have got this information from the official link of odoo documentation below:

repeatIn(list, varname[, tagname]) : repeat the current part of the template (whole document, current section, current row in the table) for each object in the list. Use varname in the template's tags. Since versions 4.1.X, you can use an optional third argument that is the name of the .RML tag you want to loop on.

https://doc.odoo.com/v6.0/developer/3_11_reports/11_1_openoffice_report.html

I want to know how to use this repeatin because i have tried it like this:

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

<para style="P7">[[ o['name'] ]]</para> 

And i have got this error:

2015-09-02 11:37:00,027 8110 ERROR openerp openerp.tools.safe_eval: Cannot eval 'repeatIn(get_employee_lines((example.company_id,example.date_start,example.date_end), o[,td])'

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 "/opt/openerp/v7/server/openerp/tools/safe_eval.py", line 162, in test_expr

code_obj = compile(expr, "", mode)

File "<string>", line 1

repeatIn(get_employee_lines((example.company_id,example.date_start,example.date_end), o[,td])

^

SyntaxError: invalid syntax

2015-09-02 11:37:00,027 8110 ERROR openerp openerp.tools.safe_eval: Cannot eval "o['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 'o' is not defined

Please, who can resolve this problem.

Regards.

Avatar
Discard
Author Best Answer

 Here is the right answer.

First, i had to change the version of my OpenOffice which is v4.1.X.

Second, i used [[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'o', 'td') ]] which Loop on every line and make a new table cell for each line.

So here is the right answer:

<tr>

<td>

<para style="P8">NOM EMPLOYÉ</para>

</td>

<td>

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

<para style="P7">[[ o['name'] ]]</para>

</td>

</tr>

Best Regards.

Avatar
Discard
Best Answer

Hello,

try this line:

<para style="P7">[[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'o') ]]</para> 
Avatar
Discard
Author

Thanks for the answer but i want to work with a new cell to each result which means this: [[ repeatIn(get_employee_lines((example.company_id,example.date_start,example. date_end), o[,td]) ]]