Odoo Help

0

What's the best way to create a report on OpenERP

By
Drees Far
on 8/21/15, 10:47 AM 661 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

0

Yenthe

--Yenthe--
6975
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 8/21/15, 10:51 AM

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

0

Drees Far

--Drees Far--
1126
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 8/21/15, 10:56 AM

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

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)

Yenthe
on 8/21/15, 11:04 AM

Thanks a lot friends. It doesnt matter ;)

Drees Far
on 8/21/15, 11:10 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: 8/21/15, 10:47 AM
Seen: 661 times
Last updated: 8/21/15, 10:56 AM