Odoo Help

4

4
2 Answers
3
Avatar

Timo Talvitie, Vizucom Oy Finland

--Timo Talvitie, Vizucom Oy--
818
| 5 4 9
Tampere, Finland
--Timo Talvitie, Vizucom Oy--

Lead developer at Vizucom.

Timo Talvitie, Vizucom Oy Finland
10/6/13, 11:36 AM

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.

2
Avatar

IBS Group Morocco

--IBS Group--
1337
| 4 6 10
Tetouan, Morocco
--IBS Group--

We are ranked Top 3 🥉  in odoo's 🔐 Security Research Program.

We develop and maintain Odoo applications and Mobile apps for more than 25 businesses and SMEs around the world operating in logistics, trade, industry and services.

We also extend existing Odoo implementations beyond their functional and technical limitations, by integrating new modules like ones related to Data Migration, Business Intelligence and Data Analytics.

We also connect odoo to any external system like Salesforce, Magento, Prestashop, ...

We speak 🇲🇦 (Arabic) 🇬🇧 (English) 🇫🇷 (French) 🇪🇸 (Spanish)

We operate from 🇲🇦 (Morocco) and 🇧🇪 (Belgium)

📫 us at contact@odoo.ma or 🤙 📱 at +212 (0) 539 99 29 18 / +32 (0) 2 361 40 88
🔗 Visit our website http://www.odoo.ma

IBS Group Morocco
10/6/13, 2:18 PM

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.

3 Comments
Torvald Baade Bringsvor, Torvald B. Bringsvor Norway
10/7/13, 7:04 PM

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.

evon_dun India
10/9/13, 7:26 AM

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.

dengwei China
1/22/14, 6:08 AM

thx very much i think you are right

Ask a Question
Keep Informed
2 follower(s)
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