Skip to Content
Menu
This question has been flagged
2 Replies
2777 Views

Hello guys!!!

I have tried to create a new report on my OpenERP. There is several methods to do this task (openoffice plugin, XML files, RML files, etc.)

What's the quickest way to do that (and/or the most beautiful and easiest one) ?

Regards

Avatar
Discard
Best Answer

Hi Drees,

In my opinion the quickest and best way is to use QWeb reports. The openoffice plugin is pretty outdated, RML is from V7 and is rather outdated. Odoo itself is changing all RML reports to QWeb reports at the moment, so that says enough. Writing QWeb reports is easy and there is barely anything you can't do.
I've written a detailed blogpost that explains you how to create QWeb reports, which you can find here: http://www.odoo.yenthevg.com/creating-custom-reports-odoo-8/

Yenthe

Avatar
Discard
Author Best Answer

Thanks a lot for you are answer but i am working with mako extension and call a function defined in my python file:


def __init__(self, cr, uid, name, context):

super(journal_paie, self).__init__(cr, uid, name, context)

print ('test test')

self.localcontext.update({

'get_lines': self.get_lines,

'cr':cr,

'uid':1,

'ctxt':context,

})

def get_lines(self, cr,uid, context=None):

ret = []

obj = self.pool.get('hr.employee')

obj_ids = obj.search(cr, uid, [])

res = obj.read(cr, uid, obj_ids, ['id'], context)

for r in res :

if r['name_related'] != 'Administrator' :

line_data = dict()

line_data['name']= r['name_related']

print r['name_related']

ret.append(line_data)

return ret


like this:


% for i in get_lines():

<tr style='height:20.65pt'>

<td width=31.9 style='width:31.9pt;border:none;border-bottom:solid windowtext 1.0pt;

background:#FCE4D6;padding:0cm 3.5pt 0cm 3.5pt;height:14.65pt'>

<p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt;

text-align:center;line-height:normal'><b><span style='font-size:8.0pt;

font-family:"Arial","sans-serif";color:black'>Nom Employé</span></b></p>

</td>

<td width=31.9 style='width:31.9pt;border:none;border-bottom:solid windowtext 1.0pt;

background:#FCE4D6;padding:0cm 3.5pt 0cm 3.5pt;height:14.65pt'>

<p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt;

text-align:center;line-height:normal'><b><span style='font-size:8.0pt;

font-family:"Arial","sans-serif";color:black'> ${i}</span></b></p>

</td>

</tr>

%endfor


and i get this error:


% for i in get_lines():

TypeError: 'Undefined' object is not callable

Traceback (most recent call last):

File "/opt/openerp/v7/server/openerp/netsvc.py", line 296, in dispatch_rpc

result = ExportService.getService(service_name).dispatch(method, params)

File "/opt/openerp/v7/server/openerp/service/web_services.py", line 654, in dispatch

res = fn(db, uid, *params)

File "/opt/openerp/v7/server/openerp/service/web_services.py", line 760, in exp_report_get

return self._check_report(report_id)

File "/opt/openerp/v7/server/openerp/service/web_services.py", line 738, in _check_report

netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)

File "/opt/openerp/v7/server/openerp/netsvc.py", line 71, in abort_response

raise openerp.osv.osv.except_osv(description, details)

except_osv: (u'Rendu webkit !', u'\n\nTraceback (most recent call last):\n File "/opt/openerp/v7/addons/report_webkit/webkit_report.py", line 265, in create_single_pdf\n **parser_instance.localcontext)\n File "/usr/lib/python2.7/dist-packages/mako/template.py", line 443, in render\n return runtime._render(self, self.callable_, args, data)\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 803, in _render\n **_kwargs_for_callable(callable_, data))\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 835, in _render_context\n _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 860, in _exec_template\n callable_(context, *args, **kwargs)\n File "memory:0x7fe8c06d1e10", line 83, in render_body\n % for i in get_lines():\nTypeError: \'Undefined\' object is not callable\n')


Can you help me please

Avatar
Discard

Sorry Drees I've never used Mako since QWeb does all I need and more people use it. I'd suggest you to create a new topic for this issue since it doesn't have anything to do with your initial question. (besides being about reports then)

Author

Thanks a lot friends. It doesnt matter ;)

Related Posts Replies Views Activity
0
Nov 18
4877
1
Mar 15
5553
1
Sep 24
333
1
Jul 24
278
1
May 24
1641