Do You know Hidden Risks of Poor ERP Implementation? Download Free E-Book

Latex - A new OpenERP Reporting Engine!

July 31, 2014 by
Latex - A new OpenERP Reporting Engine!

Hi all,

An email from Gustavo Orrillo <gustavo.orrillo@moldeointeractive.com.ar> in community!

We just developed a new openerp module that allows the creation of reports using Latex, and we wanted to share the information with you.

What is Latex?

TeX is a computer program for typesetting documents, created by Donald Knuth. It takes a suitably prepared computer file and converts it to a form which may be printed on many kinds of printers, including dot-matrix printers, laser printers and high-resolution typesetting machines. LaTeX is a set of macros for TeX that aims at reducing the user's task to the sole role of writing the content, LaTeX taking care of all the formatting process. A number of well-established publishers now use TeX or LaTeX to typeset books and mathematical journals. It is also well appreciated by users caring about typography, consistent formatting, efficient collaborative writing and open formats.

Why we used Latex? 

Well... we ran into some problems creating reports using RML and WebKit, and we thought it made sense to develop a module for creating reports using LaTex (we have some experience doing that).

How do I use the module? 

The OpenERP-addon combines "Mako Template language" and Latex to generate high-end quality reports. Latex is not a simple language but you don't need to be an expert for creating simple reports. There is a learning curve involved in using Latex, but the productivity gains of using it are very high.

You must install Latex in your server to make it works. In debian and ubuntu you can execute:

apt-get install texlive-latex-base texlive-fonts-recommended

Where can I learn Latex? 

The best place to start is http://en.wikibooks.org/wiki/LaTeX. Another good place for finding modules is CTAN (http://www.ctan.org/)

Where can I download the openerp module?

You can find the module in: https://launchpad.net/openerp-report-latex 

If you feel like trying it or documenting or suggesting new functionalities or helping with the development of the module, you are welcome to do so,

Any comments or thoughts, don't hesitate to e-mail the developers.

Cheers,

---

And a Response from Raphael Valyi, one of the most active OpenERP community members!

---

Hello Gustavo,

First kudos for the module!

As a note let me just tell you our Latex + OpenERP story:

at Akretion, during 2 years we used to produce our big OpenERP project quotes using OpenERP inside Latex reports!

Technically, the way we did it was extending the Gollum wiki (the wiki of Github https://github.com/gollum/gollum ) that already has builtin RST/markdown support via a docutils converter, so we could include RST fragments inside Latex documents (yes we added the Latex format type). Inside the documents, no matter the format, we had a first pass of ERB templating where we had OOOR objects (Ruby proxies to OpnERP via JSON/RPC https://github.com/akretion/ooor).

So we had a pipe like:

RST + ERB -> HTML | Latex -> pdf

That worked for what we needed. Much better than Openoffice copy/paste I should say.

Still recently we came to the conclusion that we could achieve results good enough by just printing the HTML gollum page in Chrome or Firefox (print to file).

That is, after using Latex for 10 years, I finally dropped my beloved Latex! We also changed the ERB template for Liquid (with erpify) that is non evaling and enables us to let our customers edit in our wiki without hacking us. So we now have a pipe much like:

RST | Markdown + Liquid -> HTML/pdf

The main advantage is we can now better mix RST and Markdown pages, and even inherit from regular HTML pages, to build our documentation in exactly the flavour our customers need. We can also take full advantage of Gollum markup that happens at the HTML level while before we had to refrain us from using it as it would not make its way to the Latex pdf. That was hurting the reusability of the documentations fragments between documentation pages and pdf documents.

We had some doubt about loosing the handy Latex Table Of Content. But Gollum has some built-in HTML Nokogiri parser that rebuild a nice page index from the final HTML structure resulting from the RST/Markdown assembly, at the end, it does the job, at least for us.

Unlike Latex, it may not be suitable to print a book. But it's enough to print a quote, a documentation or a contract. useful links:

https://github.com/akretion/erpify

https://github.com/akretion/liquid_gollum 

Finally this again boils down to the 2 choice to make reports:

1) use a print solution like Reportlab, Latex, Prawn etc..

2) use an HTML technology unaware of many print details but trying to bridge the gap.

So me moved from 1) to 2) in our specific case but the interesting points is we didn't had to abandon all the RST goodness while doing the move.

in_webinar_image