Friday, August 17, 2012

openerp fields.py - paradise of extensibility

Here is an extract of fields.py one of the openerp kernel file:

class _column(object):
   
.....

    def __init__(self, string='unknown', required=False, readonly=False, domain=None, context=None, states=None, priority=0, change_default=False, size=None, ondelete=None, translate=False, select=False, manual=False, **args):
      ...
       
        for a in args:
            if args[a]:
                setattr(self, a, args[a])
...

This last for loop is programmer paradise. It simply means you can create any field and add directly data to the field definition like a qualifier or anything you need in the constructor.

Simply cool, elegant and efficient !



Thursday, July 05, 2012

Reading the Belgian E-ID

We start a new project for which reading the Belgian identity card will be a must.

As a start, FEDICT the federal admin responsible for the e-id provides sdk and software in open-source. Cool stuff.

The first step was to checkout http://eid-viewer.googlecode.com/svn/trunk/ eid-viewer-read-only

1) I found in there a pom.xml so I tried maven (mvn command) to build.

2) The first issue was that the Maven installed by Ubuntu cannot read the config files a version 3 is required.

3) Next I moved into one of these cool error message:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project eid-viewer-lib: Compilation failure: Compilation failure:
    [ERROR] error: error reading /home/chanon/.m2/repository/be/fedict/eid-applet/eid-applet-core/1.0.5.Beta2/eid-applet-core-1.0.5.Beta2.jar; error in opening zip file
    [ERROR] error: error reading /home/chanon/.m2/repository/be/fedict/eid-applet/eid-applet-service/1.0.5.Beta2/eid-applet-service-1.0.5.Beta2.jar; error in opening zip file
    [ERROR] error: error reading /home/chanon/.m2/repository/be/fedict/eid-trust-service/eid-trust-service-client/1.0.0.GA/eid-trust-service-client-1.0.0.GA.jar; error in opening zip file
    [ERROR] error: error reading /home/chanon/.m2/repository/be/fedict/eid-trust-service/eid-trust-service-xkms2-ws/1.0.0.GA/eid-trust-service-xkms2-ws-1.0.0.GA.jar; error in opening zip file
    [ERROR] error: error reading /home/chanon/.m2/repository/org/simpleframework/simple-xml/2.6.2/simple-xml-2.6.2.jar; error in opening zip file
    [ERROR] -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project eid-viewer-lib: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

It is crap and not telling anything easily usable... luckily a Fedict expert replied very quickly on the support mailing list :

Here is a summary of the answer

The problem

"...one of the repositories that we'd included in our main pom has moved, but fails to return HTTP redirect

as it should. Instead it returns some HTML stating that "we have moved"  ... "

The solution

"... the presence of this repo in the dependencies of eid-viewer is now entirely historical and it may safely be removed...

For now, you can:

- in the top-level pom.xml, remove lines 271 to 274 ( to
incl)

 "


This tip solved my issue - great thanks to Fedict and to Frank !

Wednesday, June 13, 2012

OpenERP - Open Upgrade

Following a tweet I discovered this initiative

https://launchpad.net/openupgrade-addons

To be clear, the migration service from OpenERP is cheap and without competition. Migration of ERP at a fix low price remains unique. The value of OpenERP enterprise is clear: fixed price and increased functionality every year. Unique.

However this paid services might be a problem for very small business, non-profit and verticalisation market (more open-object than openerp). It is one of the reason some people turn to Tryton (an- openerp-fork-that-may-one-day-have-a-web-client-but-web-is-not-important-because-we-have-gtk).

The fact custom modules are not part of the migration per say (or you pay more to get them converted/migrated) leave anyway an area for an alternate market.

I don't expect this to be commercial ready, but can be an help for people ready to spend some time in custom migration !

Please note... I haven't spend a second looking at this migration code... just in case ! So don't be foolish and try migrating your live erp.

Monday, June 11, 2012

Saturday, June 09, 2012

Using nginx as a proxy to gunicorn / openerp


Following the by now best practices with 6.1, I am switching my prod and demo configruation to gunicorn. 
However, it is also recommended to setup a front-end to your server in order to make if faster and more robust.
 
Installing nginx on Ubuntu is easy as :
 
sudo apt-get nginx

setting up the server to proxy the gunicorn/ openerp, requires to add a site configuration in nginx. Here is a minimal version (it works but it contains no safety nor optimisation) :
 
server {
  listen 80;
  server_name demo.xxxx.be;
  location / {
    proxy_pass http://localhost:8069;
  }
}

See nginx.org for more info !

Thursday, June 07, 2012

6.1 technical update

Good stuff

http://www.slideshare.net/openobject/openerp-61-web-framework-tutorial

http://www.slideshare.net/openobject/openerp-61-framework-changes

Monday, June 04, 2012

Precise Pengolin - Ubuntu 12.04 LTS

Yesterday, I installed side by side the new Ubuntu Desktop LT 12.04.

I am not sure I will like the new Unity desktop. What I am sure is that this is the first install of Ubuntu that works perfectly on my HP Laptop (Elitebook 8540w). Even the sleep mode, dual screen, all installed without a glitch !

Congratulation to Canonical & Welcome to Precise Pengolin.

Wednesday, May 30, 2012

OpenERP using multi-processors with gunicorn

Due to Python limitation (aka GIL), OpenERP is basically single processor powered !

Starting 6.1, OpenERP is a wsgi application. Provided you use a good wsgi container you can now
benefit from all capabilities of your hardware.

Basic stuff:

easy_install gunicorn
easy_install psutil

Update the gunicorn.conf.py (db host, etc)

gunicorn openerp:wsgi.core.application -c gunicorn.conf.py

gunicorn provided you the ability to manage your worker process making openerp more reliable.

Config info for optimization etc at gunicorn.org

Enjoy !

Friday, May 25, 2012

Circus around Java - Google vs Oracle goes to an end ?

So  it seems Google won the case concerning Java patents...

http://www.infoq.com/news/2012/05/google-win

I think it is good for Java. The dream would be to see Oracle, thinking to play it open completely and get inspiration form others (GTW is really great).

Wednesday, May 02, 2012

Welcome to the Postgres magazine

When I decided to move to OpenERP, I had to move also to supporting technologies. Python of course (on which I still have a mixed feeling...) and Postgres.

Just one sentence : I love Postgres. It is enterprise ready, robust, extensible it is SQL and now noSQL etc etc

So join me and read pgmag.org

http://pgmag.org !

Wednesday, April 18, 2012

Community days - some links


I think presentations are worth looking at...

Presentations: http://slidesha.re/9zuI5o.
Pictures of the event: http://on.fb.me/J3Sk9p
Tweets during the event: http://bit.ly/HQImsU

Monday, April 16, 2012

Back from community days - OpenERP version 7.0

Here is a very short summary of the community days 2012. It is for sure not complete !

Version 7 :
- continue the interface improvement for better usability (e.g search screen, many2one field).
- simple EDI (not the EDI standard) exchange between apps and OpenERP instances.
- new, more object oriented API.
-continue improvement on the POS. In summary the POS paltform will be Google Chrome (because of better local storage capability).

Version 6 : Great news for those running version 6.0 -  they don't need to leave their Long Term Supported release to get the greatest benefit of 6.1. The web client (and also the outlook plugin) will be back-ported for 6.0. this should be available in April.

Release management: monthly release are gone, the integration and build will be done on a daily basis. This means that what you can download from openerp.com will change almost every days...

Of course they were a lot of very good technical presentations  (web client, pos, q-web, API, Gunicorn, file,). I also attended one excellent presentation from Akretion concerning the e-commerce connectors... great work (but still I don't think I want to put my hands in Magento).

The last day was partners only, great opportunities to hear about business oriented  topics (support, out-of-the-box project,...).

Automating OpenERP backup on windows

Unattended backup is not compatible with prompt for password. Here is a 0 cent workaround...

set PGPASSWORD=openpgpwd
pg_dump -U openpg -f mybackupfile mydbname

Enjoy !

Monday, April 09, 2012

Deploying OpenERP Server with Gunicorn (draft)

Also some good stuff in this presentation about wsgi, load balancing etc with OpenERP...

http://thu.openerp.com/open-days-2012/gunicorn-draft.html#%2820%29

This makes also the framework more attractive...

OpenERP core API library - great proposal !

Preparing the community days... I received a link to this presentation about API changes in the upcoming version 7.0. looks like ,excellent improvement with a lot of simplification, merging function, on_change and default mechanism is a great idea !

http://thu.openerp.com/open-days-2012/core-api-draft.html#%281%29

Meet you there !

Friday, February 03, 2012

Community days 2012 agenda

And now the agenda...

http://www.slideshare.net/fullscreen/openobject/openerp-opendays-2012/1

OpenERP Community & Partners - 11 -13 April 2012 Brussels - First info

Here are the first info about the community days 2012.
The lst day, April 13 is for partners only.

OpenERP Community & Partners Days 2012, Brussels (Belgium)
Université Libre de Bruxelles
Avenue Franklin D. Roosevelt 50
1050 Bruxelles
Belgium

Link to register on eventbrite :http://www.eventbrite.com/event/2516340442

Tuesday, September 20, 2011

OpenERP - ProgrammingError: operator does not exist: integer = boolean

ProgrammingError: operator does not exist: integer = boolean
LINE 1: select name, model from ir_ui_view where (id=false or inheri...
                                                    ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Well all that crap comes from the fact that an OpenERP object does not have a name... Thus undefined field is false so the error about boolean and then a cast issue in query...

Monday, September 19, 2011

OpenERP - Python - AttributeError: 'tuple' object has no attribute 'copy'

While OpenERP is a time saver for many aspects of writing a DB oriented app. Many aspects of the framework are left to the python and thus the framework.

I spent hours searching for this one...

AttributeError: 'tuple' object has no attribute 'copy'

I am too much use to declarative language like Java... so I still miss some basic reflex... This error was in the definitions of my class object:

lass bemedicalworksheet (osv.osv):
    _name = 'nisf.bemedicalworksheet'
    _columns = {
                'vipowigw': fields.boolean("Wigw"),
                },


well this last coma makes python thinking it is a tuple instead of a dictionnary...

Friday, September 09, 2011

Error 500 installing Joomla on OVH

I have not deployed / moved joomla we site since a while. Zipping and unzipping to another host put me in a permanent http 500 error. My hoster is OVH (very famous in France and Belgium).

The solution:  php script but be readable not writable, the administrator directory must be configured with chmod 755.