Linux server

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.

Contents

Environment dependencies

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.

Address: http://kndati.lv/index.php/web-links/44-open-erp-addons

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)

System Requirements:

  1. Python 2.4.x or higher (http://www.python.org/doc/)
  2. Relatorio (required v.0.5.1 or higher, http://pypi.python.org/pypi)
  3. Genshi (http://genshi.edgewall.org/)
  4. OpenOffice Python
  5. OpenOffice.org-pyuno
  6. PyYaml

Note: Server does not require “x” windows to be running, in order to run this module.

System Dependencies:

Names of dependencies may differ regarding your Linux distribution.

  1. python-relatorio: A templating library able to output odt and pdf files
  2. python-genshi: Toolkit for stream-based generation of output for the web
  3. PyYAML: YAML parser and emitter for Python
  4. pycairo: Python bindings for the cairo library
  5. pycha (install through python self installer # easy_install pycha, not included in base Centos distribution)
  6. python-openoffice: Python libraries for interacting with OpenOffice.org
  7. openoffice.org-pyuno : Python bindings for OpenOffice.org
  8. OpenOffice.org v.2.3.x or above.

Report_openoffice module Installation

1.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”.

3.Restart openerp-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-base
  • openoffice.org-calc (required)
  • openoffice.org-core (required)
  • openoffice.org-draw
  • openoffice.org-graphicfilter
  • openoffice.org-headless (required)
  • openoffice.org-impress
  • openoffice.org-sdk
  • openoffice.org-testtools
  • openoffice.org-ure
  • 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

  1. Open wizard;
  2. Fill in your custom values;
  3. Save;

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)

  1. Make new object "Administraton->Low level objets->Actions->Report XML -> New;
  2. Create new Report object;
  3. 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”
  4. Save;

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.

Adding additional print button (sample invoice)

  1. Administration -> Low Level Objects -> Client actions connections;
  2. Create new Client Action Connection;
  3. Fill information, for example:
    • Name: Sample Invoice
    • Object Name: account.invoice
    • Event Type: client_print_multi
    • Value: ir.actions.report.xml,$ID*
  4. Save.

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

Copyright © 2001 Alistek Ltd., ALL RIGHTS RESERVED