Odoo Help

Welcome!

This community 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.

-2

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

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

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
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

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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