Ask Your Question
4

How do I start using WebKit reports?

asked 2013-10-05 23:48:29 +0200

Torvald B. Bringsvor gravatar image Torvald B. Bringsvor
113 4 7 12

As the OpenOffice plugin seems to be both unmaintaned and broken, I'm looking for alternatives. And, at least if I am to limit myself to the SaaS offer, there seems to be only WebKit.

But documentation seems to be hidden away somewhere, do any of you have any info on how to start out with WebKit, for example to customize a payslip or invoice?

delete close flag offensive retag edit

Comments

I want to know too.

Abdullah Sofan ( 2013-10-06 00:12:21 +0200 )edit

I advise you to simply learn RML, it's simple once you get the hang of it, here is their full guide: www.reportlab.com/docs/rml2pdf-userguide.pdf‎.

IBS ( 2013-10-06 18:12:11 +0200 )edit

The openoffice plug-in works, but you need an older openoffice version. Try 3.4.1 or 3.3.0. Iirc, 3.4.1 works here.

Roel Adriaans ( 2013-10-08 03:09:53 +0200 )edit

2 Answers

Sort by » oldest newest most voted
3

answered 2013-10-06 15:36:01 +0200

Timo Talvitie gravatar image Timo Talvitie flag of Finland
390 1 4 12
http://www.linkedin.com/i...

I recommend that you start out with some simple community module that utilizes webkit reports. I personally like the sale_order_webkit by camptocamp, it's downloadable at https://www.openerp.com/apps/trunk/sale_order_webkit/

Here's a quick rundown of the basics of the module contents.

__openerp__.py

Make note of the required dependencies, report_webkit and base_headers_webkit. The former is the core module that makes using webkit reports possible in the first place. The latter provides some headers for your reports (header usually includes the client name, company name and logo, shipping address etc). It basically puts reusable header templates to the database so they can be utilized by your reports. You can also make your own headers, so installing that module is not mandatory, but it is good for getting started.

sale_report.xml

The <report> item tells OpenERP about your new report. Its Model attribute defines what type of object your report is handling, e.g. sale.order, account.invoice... The menu item that the user clicks to see the actual report will be shown in the Print menu when you are viewing objects of that type, and the text for that menu item is defined by the String attribute. With the id attribute you can override an existing report in a menu, e.g. a sale order RML report defined by the sale module.

The file attribute is perhaps the most important, as it defines the path to the mako file that is actually used to render your report. Also, don't forget to set the report_type to webkit.

webkit_header defines the used header in module.header_name notation (e.g. my_module.basic_portrait). You can view all available headers by going to the Settings -> Technical -> Webkit headers/footers menu in OpenERP. If you installed the base_headers_webkit module, you should see some options available there.

report/sale_order.mako

The report template itself. The mako files enable you to format the report with html and css, and you can still access all your OpenERP objects with inline python code. You can read more about the mako syntax at http://www.makotemplates.org/ but if you're already familiar with html and python, a good part of it should be pretty self-explanatory.

report/sale_order.py

The report is registered at the bottom of the file with report_sxw.report_sxw, and if needed you can also use the localcontext.update function to give the mako template access to some data calculated by your python functions, e.g. calculating discounts for special customers. But for getting started and making a basic report there is very little you need to do in this file.

Also, you need to install wkhtmltopdf in your operating system to get the PDF reports generated, but if you're using the SaaS version I imagine that has been taken care of for you already.

That's a quick overview that will hopefully get you started. The webkit reports are a really convenient tool once you get past the initial learning curve.

link publish delete flag offensive edit
0

answered 2013-10-06 18:18:59 +0200

IBS gravatar image IBS flag of Morocco
1093 7 18
http://www.ibs-na.com/

I advise you to simply learn RML and write the reports yourself instead of using OpenOffice

The reason is because webkit has some limitations that are crucial to reports, such as repeating table headers/footers (*) which is easily achievable in RML

(*): https://bugs.webkit.org/show_bug.cgi?id=17205

Over all, RML is very easy once you get the hang of it, here is their full guide: http://www.reportlab.com/docs/rml2pdf-userguide.pdf

Plus, writing RML code yourself is easier than using OpenOffice because it gives you more flexibility on what structure you want to achieve.

link publish delete flag offensive edit

Comments

1

Yeah, I think I'll have a go with RML. A bit strange that OpenERP themselves seems to discourage it, but provide no real alternative IMHO. But it seems I'll stay on hosting my own OpenERP instance, since the edit-RML module is not available in SaaS, and you can't install your own modules either.

Torvald B. Bringsvor ( 2013-10-07 23:04:43 +0200 )edit

Do anyone knows how to email these webkit reports through email to the partner? For example Partner Ledger Report? Or can anyone help in writing a template for it. I tried but i want to save the report to attachment in database, with the 'partner_name.pdf' filename. Please help its really urgent.

evon ( 2013-10-09 11:26:04 +0200 )edit

thx very much i think you are right

dengwei ( 2014-01-22 11:08:28 +0200 )edit

Login/Signup to Answer

Documentation

You can download ebooks on Facebook or buy paper book

You can read the online documentation

Question tools

Follow
4 followers

subscribe to rss feed

Stats

Asked: 2013-10-05 23:48:29 +0200

Seen: 2,027 times

Last updated: Oct 06 '13