This article covers installation process for OpenERP OpenOffice.org reporting engine on Linux servers. If you find this article useful or want to add some information related to this topic, please feel free to express your opinion on OpenOffice.org Reporting Engine dedicated forum.
Development project page is located on Launchpad.
1.Open ERP server v. 5.x
2.OS: any Linux 32bit or 64bit. (tested on Fedora Core9/11 and Centos5.3 64bit)
Note: Clients can work on all OS systems that support OpenERP.
Note: This module is tested on Windows, and works on this operating system as well. Installation manual yet to be written.
Download: Sources available from launchpad via Bazaar.
Source online: https://launchpad.net/report-openoffice
Download: Packaged module available from KN dati web page.
How to get module
1.Download report_openoffice module through launchpad via Bazaar ( A distributed revision control system ).
# cd /usr/src # bzr branch lp:report-openoffice
2.Latest version available at www.kndati.lv download section.
Installation (Dependencies and Base system setup)
- Python 2.4.x or higher (http://www.python.org/doc/)
- Relatorio (required v.0.5.1 or higher, http://pypi.python.org/pypi)
- Genshi (http://genshi.edgewall.org/)
- OpenOffice Python
Note: Server does not require “x” windows to be running, in order to run this module.
Names of dependencies may differ regarding your Linux distribution.
- python-relatorio: A templating library able to output odt and pdf files
- python-genshi: Toolkit for stream-based generation of output for the web
- PyYAML: YAML parser and emitter for Python
- pycairo: Python bindings for the cairo library
- pycha (install through python self installer # easy_install pycha, not included in base Centos distribution)
- python-openoffice: Python libraries for interacting with OpenOffice.org
- openoffice.org-pyuno : Python bindings for OpenOffice.org
- OpenOffice.org v.2.3.x or above.
Report_openoffice module Installation
a)Manually: Copy report_openoffice module to $serverpath/openerp-server/addons/..
b)Through OpenERP interface: Administration -> Modules Management -> Import Module
2.Modify OpenERP launch script (adding python path, important!!!)
# nano /usr/bin/openerp-server
add line before other entries - export PYTHONPATH="/usr/lib64/openoffice.org/program/" #Change to your appropriate OpenOffice path.
File should look like this:
#!/bin/sh #added for pyuno export PYTHONPATH="/usr/lib64/openoffice.org/program/" #change this to your OOo path!!! cd /usr/lib/python2.4/site-packages/openerp-server exec /usr/bin/python ./openerp-server.py $@
If you prefer to launch server through command line, not modifying launch script, then you must enter in shell this command before launching server:
# export PYTHONPATH="/usr/lib64/openoffice.org/program/" and then launch server itself # python ./openerp-server.py
Note: in this situation settings will not persist after logout, so you will have to do this every time you log in for particular user before launching server. If you want to save settings, then you must modify openerp-server launch script.
Note: If you don't follow this, you will get error - “importError: No module named pyuno, when installing report_openoffice module or restarting server”.
4.Install report_openoffice via Administration-> Modules Management
5.Restart OpenERP server.
If everything went well, system is ready for reports printing.
OpenOffice dependencies for PDF convertion.
Note: These dependencies are required only for converting invoice report to PDF:
- openoffice.org-calc (required)
- openoffice.org-core (required)
- openoffice.org-headless (required)
- openoffice.org-writer (required)
Note: Headless OpenOffice below version 3.x. requires package – OpenOffice Headless. Package permits OpenOffice to launch in service mode. If you have OpenOffice 3.x or above, then you don't need to install this package, because in versions 3.x or above OpenOffice Headless is already implemented.
If you get an error message like this:
/usr/lib64/openoffice.org/program/soffice.bin X11 error: Can't open display: Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details)
...when starting OpenOffice in shell with "-headless" switch - it means that package openoffice-headless is not installed.
Testing OpenOffice headless mode.
To test if OpenOffice is correctly set up, go to OpenOffice installation directory and launch it in headless mode.
# ./soffice -nologo -nofirststartwizard -headless -norestore -invisible "-accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;" &
Then test with telnet:
# telnet localhost 8100
If you get something like this:
Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. `ø'com.sun.star.bridge.XProtocolPropertiesUrpProtocolPropertiesÜZĪŨkÎ@ëÚøBE^[[?6c
...then OpenOffice is up and listening to port 8100.
Note: In order to use uno module included in OpenOffice, your OpenOffice distribution must be compiled for the same version of python than you use for Open ERP server.
Configure connection parameters to OpenOffice.org service
Administration ->Low Level Objects -> OpenOffice Connection
- Open wizard;
- Fill in your custom values;
On success you should receive message:"Connection to the OpenOffice.org instance was successfully established and PDF convertion is working."
If it fails with error : “Connection to OpenOffice.org instance was not established or convertion to PDF unsuccessful!”
It was unable to connect to OpenOffice.org or OpenOffice.org was unable to perform PDF conversion.
Configuring new report object (sample invoice)
- Make new object "Administraton->Low level objets->Actions->Report XML -> New;
- Create new Report object;
- Fill information, for example:
- Name: Sample Invoice
- Object: account.invoice
- Internal name: account.invoice.sample
- Type: “OpenOffice - odt/ods output” (creates ODT/ODS editable files) or “OpenOffice - pdf output” (creates PDF files)
- Template path: for example “account/report/invoice.odt”
Note: It's possible to change to PDF printing by changing printing type to “OpenOffice - pdf output”.<p> <p>For this to work, OOo requires to be started in headless mode.
- Administration -> Low Level Objects -> Client actions connections;
- Create new Client Action Connection;
- Fill information, for example:
- Name: Sample Invoice
- Object Name: account.invoice
- Event Type: client_print_multi
- Value: ir.actions.report.xml,$ID*
* where $ID is Previously created Sample Invoice object ID number! (can be found at the bottom of GTK client, when Sample Invoice object is opened.)
Now you can open any invoice and try to print with "Sample Invoice" button. Output should be as .odt or .pdf document, depends on what output type you have chosen.
If you can not find additional print button next to Invoice, you may have to restart client application.