Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3231 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć

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)

Autor

Thanks a lot friends. It doesnt matter ;)

Powiązane posty Odpowiedzi Widoki Czynność
0
lis 18
5407
1
mar 15
6051
1
kwi 25
558
1
wrz 24
1322
1
lip 24
1116