def _blank_line(self,nlines):
res = ""
for i in range(nlines - self.line_no):
res = res + '\n'
return res
def _line_no(self):
self.line_no = self.line_no + 1
return self.line_no
This is my orper.py And now ...In my RML code :
<para style="terp_default_8">[[ repeatIn(o.order_line,'line') ]][[ line_no() ]][[ line.name or ' ' ]] </para>
<blockTable colWidths="20.0,100.0,150.0,80.0,50.0,20.0,60.0,50.0" style="Table_Order_Pur_line_Content">
<tr>
<para style="terp_default_8"><font color="white">[[ blank_line(10) ]][[ setTag('para','xpre') ]]</font></para>
<td>
i can not generate report. what is the error.
3-12-09 17:24:46,257 5716 INFO Test_Dec werkzeug: 127.0.0.1 - - [09/Dec/2013 17:24:46] "POST /web/dataset/call_kw HTTP/1.1" 200 -
2013-12-09 17:24:46,276 5716 INFO Test_Dec werkzeug: 127.0.0.1 - - [09/Dec/2013 17:24:46] "POST /web/dataset/call_kw HTTP/1.1" 200 -
2013-12-09 17:24:47,828 5716 INFO Test_Dec werkzeug: 127.0.0.1 - - [09/Dec/2013 17:24:47] "POST /web/action/load HTTP/1.1" 200 -
2013-12-09 17:24:48,104 5716 ERROR Test_Dec openerp.tools.safe_eval: Cannot eval 'line_no()'
Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\.\openerp\tools\safe_eval.py", line 241, in safe_eval
File "", line 1, in <module>
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\openerp\addons\purchase\report\order.py", line 38, in _line_no
TypeError: range() integer end argument expected, got order.
2013-12-09 17:24:48,104 5716 ERROR Test_Dec openerp.tools.safe_eval: Cannot eval "blank_line(10)]][[ setTag('para','xpre')"
Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\.\openerp\tools\safe_eval.py", line 241, in safe_eval
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\.\openerp\tools\safe_eval.py", line 107, in test_expr
File "<string>", line 1
blank_line(10)]][[ setTag('para','xpre')
^
SyntaxError: invalid syntax
2013-12-09 17:24:48,104 5716 WARNING Test_Dec openerp.report.render.rml2pdf.utils: rml_tag: "blank_line(10)]][[ setTag('para','xpre')"
Traceback (most recent call last):
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\.\openerp\report\render\rml2pdf\utils.py", line 84, in _child_get
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\.\openerp\tools\safe_eval.py", line 241, in safe_eval
File "C:\Program Files\OpenERP 7.0-20131021-123225\Server\server\.\openerp\tools\safe_eval.py", line 107, in test_expr
File "<string>", line 1
blank_line(10)]][[ setTag('para','xpre')
^
SyntaxError: invalid syntax
To have access to *line_no()* and *blank_line()* in your RML file you need to declare them in the localcontext dictionary of your parser class. In your __init__() method of your order.py you should have something like
Do you have it?