Source: Wiki Alistek (creators of report_aeroo).

The purpose of this page is to describe how to install and create reports with the module report_aeroo.
In our experience trying different ways to create reports in OpenERP, we find in report_aeroo the easiest and fastest option.
While the wiki of Alistek describes in detail how to install and use the module report_aeroo is interesting to show how easy it is to create reports with this module.


The installation steps are designed to be carried out in a GNU / Linux server. In particular, the Ubuntu 10.4.
To install on Windows, see: Installing on Windows .
Before you can install report_aeroo , we must install its dependencies. As described in the wiki , we need to install the following:
From the source:
  • Aeroolib . This is the main library that uses report_aeroo. To install aeroolib, we have the package python-setuptools and run python setup.py install in the directory where downloaded aeroolib.
Aeroolib installation will install python-lxml python-Genshi and therefore do not need us to install these from the repositories.
From the repositories:
  • Genshi => python-Genshi (not necessary, and install it aeroolib)
  • OpenOffice Python => python-openoffice
  • OpenOffice . org-pyuno =>?
  • python-lxml => python-lxml (Not necessary, I installed aeroolib)
In OpenERP:

Potential Problems

When installing Ubuntu 4.10 64 bit, calling the action that generates the report we received the following error:
[des]activar nros. de línea

  1   File "/ usr/lib/python2.6/zipfile.py", line 716, in _GetContents
2 self. _RealGetContents ()
3 File "/ usr/lib/python2.6/zipfile.py", line 728, in _RealGetContents
4 BadZipfile raise, "File is not a zip file"

In this launchpad page explains the following: “This is base64 encoded Because self.template is. When I put a base64.decodestring () in OOSerializer.init (), it started to work.”
And add a patch:
modified file ‘aeroolib / aeroolib / plugins / opendocument.py’
[des]activar nros. de línea

  1   OOSerializer class:
3 def __ init__ (self, oo_template, oo_styles = None):
4 - Self. Template = oo_template
5 + Import base64
6 + Self. Template = StringIO (base64. Decodestring (oo_template. GetValue ()))

In my installation, the file opendocument.py be found at:
/ Usr/local/lib/python2.6/dist-packages/aeroolib-1.0.0-py2.6.egg/aeroolib/plugins/opendocument.py

Creating a report

To create the report, we need 3 files: a template, a parser and an XML file.
To demonstrate the creation of a report, we will use the module “ejemplo_reportes”. It contains the following classes:
[des]activar nros. de línea

  1   ejemplo_reportes_habitante class (osv. osv):
2 _name = 'ejemplo_reportes.habitante'
3 _columns = {
4 'Name': fields. Char ('Name', size = 20, required = True),
5 'Name': fields. Char ('Name', size = 20, required = True),
6 'Age': fields. Integer ('Age'),
7 'Ciudad_id': fields. Many2one ('ejemplo_reportes.ciudad', 'City'),
8 }
10 ejemplo_reportes_ciudad class (osv. osv):
11 _name = 'ejemplo_reportes.ciudad'
12 _columns = {
13 'Name': fields. Char ('Name', size = 20, required = True),
14 'Habitante_ids': fields. One2many ('ejemplo_reportes.habitante', 'ciudad_id', 'Population')
15 'Pais_id': fields. Many2one ('ejemplo_reportes.pais', 'Country'),
16 'ZIP_CODE': fields. Integer ('Postal Code'),
17 }
19 ejemplo_reportes_pais class (osv. osv):
20 _name = 'ejemplo_reportes.pais'
21 _columns = {
22 'Name': fields. Char ('Name', size = 20, required = True),
23 'Ciudad_ids': fields. One2many ('ejemplo_reportes.ciudad', 'pais_id', 'Cities'),
24 }

In this simple example, a country has several cities and several city residents.


In the parser, we can declare variables and methods and then access them from the template. As you can see, the dictionary “localcontext” contains a method and a list. In the template we can see how we access these items.
[des]activar nros. de línea

  1   "" "
2 Class for reporting parser report_informe.
3 "" "
4 report from import report_sxw
5 report.report_sxw import from rml_parse
6 import random
8 class Parser (report_sxw. rml_parse):
9 def __ init__ (self, cr, uid, name, context):
10 super (Parser, self). __ init__ (cr, uid, name, context)
12 # Get the id of the country for which you are printing the report.
13 self. pais_id = context ['active_id']
15 # This dictionary contains the elements (methods or variables) that can be accessed from the template.
16 self. localcontext. update ({
17 'Calcular_habitantes': self. Calcular_habitantes,
18 'Otros_paises': self. Get_otros_paises (),
19 })
21 calcular_habitantes def (self, pais_id):
22 "" "
23 Calculate the number of people to a country.
24 It receives as parameter the id of ejemplo_reportes.pais for which we
25 calculate the number of inhabitants.
26 "" "
27 ciudad_ids = self. pool. get ('ejemplo_reportes.ciudad'). search (self. cr, self. uid, [('pais_id', '=', pais_id)])
28 return self. pool. get ('ejemplo_reportes.habitante'). search (self. cr, self. uid, [('ciudad_id', 'in', ciudad_ids)], count = True)
30 get_otros_paises def (self):
31 "" "
32 Returns a list of browse_record with all countries except the country
33 for which you are printing the report.
34 "" "
35 pais_ids = self. pool. get ('ejemplo_reportes.pais'). search (self. cr, self. uid, [('id', '! =' self. pais_id)])
36 return self. pool. get ('ejemplo_reportes.pais'). browse (self. cr, self. uid, pais_ids)


The template we define a odt file. To view it, download it here. We can see how to create a template in the “Templating” of the wiki Alistek

Number of inhabitants:
Postal Code

Other countries:


In the xml file, the record must indicate that defines the action used to launch the report. Alli should indicate, among other things, what the parser and as is the template of the report.


id= "ejemplo_reportes_report_pais_id" model= "ir.actions.report.xml">
"name"> Report for a country

"type"> ir.actions.report.xml
"model"> ejemplo_reportes.pais
"report_name"> report_informe
"report_type"> aeroo
"in_format"> oo-odt
"parser_loc"> ejemplo_reportes / report / parser_informe.py
"report_rml"> ejemplo_reportes / report / template_informe.odt
"parser_state"> loc
"tml_source"> file

"'action'" name= "key" />
"'client_print_multi'" name= "key2" />
"['ejemplo_reportes.pais']" name= "models" />
"name"> report_informe

"'ir.actions.report.xml,'+str(ejemplo_reportes_report_pais_id)" name= "value" />
"true" name= "isobject" />
"true" name= "replace" />


From the menu Administration> Customization> Aeroo Reports> Reports, we can see and edit the reports we create.
From the latest report_aeroo, we may use frames within the templates. These are very useful when we need to have control over the position of any element. For example, when you need to print pre-printed invoices.
In this tutorial you need more theory. Would be nice to have a description of each field indicating the xml file.

More Information

The module report_aeroo_sample brings a template and an example parser. In the template you can see several examples of the syntax that we use to create reports.