Posts Tagged ‘openERP’

OpenERP 7.0 with full RTL Right-to-Left Support on openSuSE 12.1

Saturday, June 1st, 2013

Today, we installed the latest openERP 7.0 on our openSuSE 12.1 server. Also, we patched the new openERP 7.0 code similar to our post  to enable RTL support. As of now, all is working great with full support for Arabic and Hebrew.

Error – OpenERP-Web client dies as soon as you log out

Saturday, January 5th, 2013

Lately, we have been getting below error from the openERP-web client as soon as we log out the console session :

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/wsgiserver/", line 1174, in communicate
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/wsgiserver/", line 544, in respond
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/wsgiserver/", line 556, in _respond
    response = self.wsgi_app(self.environ, self.start_response)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 239, in __call__
    return app(environ, start_response)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 130, in __call__
    return self.wsgiapp(environ, start_response)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 313, in __call__
    return head(environ, start_response)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 301, in tail
    return self.response_class(environ, start_response, self.cpapp)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 74, in __init__
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 96, in setapp
    _cherrypy.log(tb, severity=40)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 385, in __call__
    return log.error(*args, **kwargs)
  File "/usr/local/lib/python2.6/site-packages/CherryPy-3.1.2-py2.6.egg/cherrypy/", line 55, in error
    self.error_log.log(severity, ' '.join((self.time(), context, msg)))
  File "/usr/local/lib/python2.6/logging/", line 1093, in log
    self._log(level, msg, args, **kwargs)
  File "/usr/local/lib/python2.6/logging/", line 1143, in _log
  File "/usr/local/lib/python2.6/logging/", line 1153, in handle
  File "/usr/local/lib/python2.6/logging/", line 1190, in callHandlers
  File "/usr/local/lib/python2.6/logging/", line 669, in handle
  File "/usr/local/lib/python2.6/logging/", line 778, in emit
  File "/usr/local/lib/python2.6/logging/", line 720, in handleError
    traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
  File "/usr/local/lib/python2.6/", line 124, in print_exception
    _print(file, 'Traceback (most recent call last):')
  File "/usr/local/lib/python2.6/", line 13, in _print
IOError: [Errno 5] Input/output error

This error can be avoided using :

nohup python2.6 &

Installing OpenERP 5 on openSuSE 12 servers

Saturday, December 29th, 2012

OpenERP version 5 won’t work with python 2.7 installed be default on openSuSE 12.1 server. The trick is to download and install python 2.6 as source and install it parallel to default version.

After that, you’ll have two python executables on the system, python (for 2.7) and python2.6 for the outdated version. The 2.6 version will be used to start the openerp server as below :

python2.6 -r dbuser -w dbpassword &


Also, you need to install system wide packages needed by default installation of the openERP system. And you must use python2.6 or easy_install-2.6 to install missing python modules. My system was up and running after installing below python modules :

python modules

You must choose the same python module version numbers, update versions won’t work.

Error with OpenERP web client

Tuesday, November 20th, 2012

After transferring our openERP 5.0.16 server to a new host, we are getting this error message while trying to add an attachment through the web client :

a class that defines __slots__ without defining __getstate__ cannot be pickled

The problem was that the default version of cherrypy was 3.2.2 and the web-server seems to have needed 3.1.2.
You can use  ‘easy_install cherrypy==3.1.2’ to install the required version and now the web-server works fine.


Error Exporting from OpenERP GTK Client 5.0.16

Friday, April 6th, 2012

Recently, I have been unable to export Customer Invoices list from the GTK client 5.0.16. But I could export supplier invoices and all other forms just as easy. I can also export customer invoices using the web interface and using NanTic Koo KDE client.

I usually get this error while trying to export customer invoices list :

Traceback (most recent call last):
File “/home/user/openERP/openerp-client-5.0.16/bin/modules/gui/”, line 1334, in _sig_child_call
res = wid.handlers[button_name]()
File “/home/user/openERP/openerp-client-5.0.16/bin/modules/gui/window/”, line 281, in sig_save_as
win = win_export.win_export(self.model, self.screen.ids_get(), self.screen.fields, fields, parent=self.window, context=self.context)
File “/home/user/openERP/openerp-client-5.0.16/bin/modules/gui/window/”, line 174, in __init__
File “/home/user/openERP/openerp-client-5.0.16/bin/modules/gui/window/”, line 241, in fill_predefwin
self.predef_model.append(([f[‘name’] for f in fields], export[‘name’], ‘, ‘.join([self.fields_data[f[‘name’]][‘string’] for f in fields])))
KeyError: u’reference’

I found out comparing old and new backups of my database, that there’s a line in ir.exports table that’s not showing in the predefined export fields. Deleting all rows in this table made the client functioning as it used to.

RTL support in OpenERP 5.0.11 and openSuSE 11.1 64 bits server.

Thursday, September 2nd, 2010

Today, we managed to implement a solution that allows RTL Arabic support for OpenERP 5.0.11 reporting engine on our openSuSE 11.1 64 bits server.

It has to do with enabling RTL in ReportLab, which is used by OpenERP to produce PDF reports. Also, OpenERP server code has to be patched to allow it to identify RTL and LTR test direction. OpenERP reporting engine is by default recognizes LTR only.

Support for unicode characters has to be enabled to allow the display of Arab and Hebrew characters.

No more details can be provided as although the solution is open source, we don’t have the permission from the author to publish it.

COPY – Enabling Arabic Support in OpenERP Reports – COPY

Sunday, August 8th, 2010

Below post is just a copy of :

OpenERP 5.0 relies on ReportLab 2.3 to create PDF reports. However, ReportLab 2.3 does not support RTL languages, and thus OpenERP does not support them as well. The following steps fix the issue in both ReportLab 2.3 and OpenERP 5.0.

Fixing ReportLab

To enable RTL language support in ReportLab 2.3, we need to modify some of its code, and build two supporting libraries, namely FriBiDi2 and PyFribidi2.

Building Dependencies

The following steps were tested on Ubuntu 9.04 (Jaunty). First, remove older libraries and install libraries necessary for building the new sources.

sudo apt-get purge libfribidi0 python-pyfribidi && sudo apt-get install autoconf gcc

Second, download FriBiDi2 (the latest at the time of writing is fribidi-0.19.2), extract it, open a shell in the extracted directory and execute the following command:

./configure && make && sudo make install

Next, download PyFribidi2 (the latest at the time of writing is pyfribidi2-0.8.0), extract it, open a shell in the extracted directory and execute the following command:

sed -i -r 's/\bfribidi2(\b|_)/fribidi\1/g' configure

[ `python -c 'import sys; print sys.version[:3]'` == '2.6' ]
&& sed -i -r 's/\bsite-packages\b/dist-packages/g' configure

./configure && make && sudo make install

Finally, verify the installation by opening a shell, changing to the home directory, starting the Python interpreter and importing pyfribidi2:

>>> import pyfribidi2

Note: If you get an error about not being found, try to reboot your machine. If the error still persists, you may need to edit ”/etc/”, adding the following line at the end of the file: ”/usr/local/lib” (without the quotes). Then run `sudo ldconfig`.

Modifying the code

Three files need to be modified in ReportLab’s code. The default installation of ReportLab in Ubuntu with Python 2.6 places it in the directory ”/usr/lib/python2.6/dist-packages/reportlab/”. We will need to modify the files there using an editor that is run in super user mode (e.g. `sudo vim`). I will refer to the files below using the relative path in ReportLab’s director.

We need to modify the search path that ReportLab uses to search for fonts to include the default path on Ubuntu.

In the variable T1SearchPath, add the following value as the last element in the tuple (approximately at line 67):


Do the same for TTFSearchPath, adding the following value as the last element in the tuple (approximately at line 85):


And do the same for CMapSearchPath, adding the following value as the last element in the tuple (approximately at line 113):



We need to import PyFribidi2 and call it before text is output to the PDF.

Add the following lines after the import statements (approximately at line 19):

# try to import pyfribidi
    import pyfribidi2 as pyfribidi
    log2vis = pyfribidi.log2vis
    DIR_ON = pyfribidi.ON
    DIR_LTR = pyfribidi.LTR
    DIR_RTL = pyfribidi.RTL
    import warnings
    warnings.warn('pyfribidi is not installed - RTL not supported')
    log2vis = None
    DIR_ON = DIR_LTR = DIR_RTL = None

Add a parameter to specify direction in PDFTextObject.init (approximately at line 135), so that the method declaration becomes as follows:

    def __init__(self, canvas, x=0,y=0, direction = 'LTR'):
        self.direction = direction

Finally, add a call to PyFribidi2 at the top of PDFTextObject._formatText (approximately at line 314), so that it becomes like this:

    def _formatText(self, text):
        "Generates PDF text output operator(s)"
        # Use pyfribidi to write the text in the correct visual order.
        directions = { 'LTR': DIR_LTR, 'RTL': DIR_RTL }
        text = log2vis(text, directions.get(self.direction, DIR_ON))


Right before the comment ”#now the font for the rest of the paragraph”, add the following lines (approximately at line 1337):

                # set the paragraph direction
                if == 'RTL':
                    tx.direction = 'RTL'

Fixing OpenERP

The fixes below have been adapted from the ReportsUnicode wiki on OpenObject’s website. However, the code in the wiki does not work correctly, so I have fixed a few things in it (and will hopefully fix the wiki soon). Only two files need to be changed: ”[bin/]report/render/rml2pdf/” and ”[bin/]report/render/rml2pdf/”.


Replace the code in this file by the following code:

import os, stat
from tools.misc import debug
from reportlab import rl_config
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase import ttfonts
from reportlab.lib.fonts import addMapping

def rl_isreg(filename, dirname):
        st = os.stat(os.path.join(dirname, filename))
    except OSError, reason:
        if reason.errno == 2:
            return False
    return stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)

for dirname in rl_config.TTFSearchPath:
    for root, dirs, files in os.walk(dirname): #@UnusedVariable
        for file in [x for x in files
                     if x.lower().endswith('.ttf') and rl_isreg(x, root)
            filename = os.path.join(root, file)
                face = ttfonts.TTFontFace(filename)
                pdfmetrics.registerFont(ttfonts.TTFont(, filename, asciiReadable=0))
                addMapping(face.familyName, face.bold, face.italic,

from trml2pdf import parseString, parseNode


Right before the parseNode function, add the following function (approximately at line 777). It replaces a number of standard PDF fonts with alternatives that support Unicode characters. I haven’t tried all of them, but Helvetica –> DejaVuSans works for me.

def changeFonts(data):
    fontmap = {
        'Times-Roman':                   'DejaVuSerif',
        'Times-BoldItalic':              'DejaVuSerif-BoldItalic',
        'Times-Bold':                    'DejaVuSerif-Bold',
        'Times-Italic':                  'DejaVuSerif-Italic',

        'Helvetica':                     'DejaVuSans',
        'Helvetica-BoldItalic':          'DejaVuSans-BoldOblique',
        'Helvetica-Bold':                'DejaVuSans-Bold',
        'Helvetica-Italic':              'DejaVuSans-Oblique',

        'Courier':                       'DejaVuSansMono',
        'Courier-Bold':                  'DejaVuSansMono-Bold',
        'Courier-BoldItalic':            'DejaVuSansMono-BoldOblique',
        'Courier-Italic':                'DejaVuSansMono-Oblique',

        'Helvetica-ExtraLight':          'DejaVuSans-ExtraLight',

        'TimesCondensed-Roman':          'DejaVuSerifCondensed',
        'TimesCondensed-BoldItalic':     'DejaVuSerifCondensed-BoldItalic',
        'TimesCondensed-Bold':           'DejaVuSerifCondensed-Bold',
        'TimesCondensed-Italic':         'DejaVuSerifCondensed-Italic',

        'HelveticaCondensed':            'DejaVuSansCondensed',
        'HelveticaCondensed-BoldItalic': 'DejaVuSansCondensed-BoldOblique',
        'HelveticaCondensed-Bold':       'DejaVuSansCondensed-Bold',
        'HelveticaCondensed-Italic':     'DejaVuSansCondensed-Oblique',
    for old, new in fontmap.iteritems():
        data = data.replace('"'+old+'"', '"'+new+'"')
    return data

Then, put the following line at the very top of each of parseNode and parseString (approximately at lines 812 and 820), before the call eTree.XML(rml):

    rml = changeFonts(rml)


(Tested on OpenERP Server 5.0.5 only)

In the method _rml_flowable._textual, modify the line that reads rc1 += etree.tostring(txt_n, encoding=unicode) (approximately at line 460) to become:

                rc1 += etree.tostring(txt_n, encoding=unicode)

That should be all. OpenERP should be all set and ready for creating Arabic reports.


Friday, February 27th, 2009

Today, we have employed OpenERP open source ERP suite for the first time in our offices. It will be used to manage inventories, deliveries, account payables and receivables.

As a first step, we have recorded year 2008 ending inventories. And we will gradually store sales and purchasing data in the database.

OpenERP is an open source suite that is based on a client-server platform. The server connects to a PostgreSQL database and the client connects to the server afterwards.

We will post the outcome of this experiment as more information are available.