Odoo Help

-2

repeatIn(list, varname[, tagname]) -> NameError: name 'o' is not defined

By
Drees Far
on 9/2/15, 7:41 AM 674 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.

-1
Drees Far
On 9/2/15, 9:13 AM

 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.

0
Ahmed M.Elmubarak
On 9/2/15, 8:09 AM

Hello,

try this line:

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

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]) ]]

Drees Far
on 9/2/15, 8:16 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/2/15, 7:41 AM
Seen: 674 times
Last updated: 9/3/15, 5:39 AM