This question has been flagged
2 Replies
14805 Views

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?

Avatar
Discard

I want to know too.

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‎.

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.

Best Answer

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.

Avatar
Discard
Best Answer

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.

Avatar
Discard
Author

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.

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.

thx very much i think you are right