Monday, October 01, 2012

Company_id default value

  
Looking at base objects in OpenERP is always source of inspiration.

I found the following

 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'res.partner', context=c),

So there is a method for finding the company_id to use for an object - here a partner. Company_id is important since this field is used for partitioning your db between different companies.

Even better looking at res.partner, I found  ab oject called  'multi_company.default' !

Basically there is a small  and 'hidden' rules engine to set company_id ! Nice. 

Sunday, August 26, 2012

Our KB project - going to Drupal

Very often we exchange tips with colleagues and partners. Things like do you have an example in OpenERP of a search / function field etc

Simply, we exchanges these by e-mail. Best of them go in mail folders.

When working on windows I am using OneNote (great MS office app with IMHO no open-source close equivalent).

I think these e-mails represent valuable material. Good for us during projects, but may be good for other people. So I decided to setup a knowledge-base web site where we can easily store and publish tips and code snippet.

My intention is to use Drupal instead of my usual Joomla. There are 2 keys reasons:

  • Taxonomy : in Joomla the section/category is limited and makes impossible to classify articles. World is not a 2 levels tree - n level (Joomla 2.5) is not better. What I am waiting for since at 7 years: be able to put 1 article in multiple categories... E.G python / openerp / query / partner etc
  • Front-editing : I just want to be able to login and change , cut and paste articles directly. The separation between the site and the admin may give security feeling for a classical site but is clear not appropriate for a community sharing site. 
Installing Drupal 7 is as easy as with Joomla.

Creating content-type is also easy to manage. In Drupal 7 the so called CCK is now a core module. One click and you are done.

However my first snippet post was disappointing... All the alignments are lost. Well for python samples with indent being semantically import the result was not that bad.

2 google search later? I found a Geshi filter module. Well a drupal module using a PHP library called GeSHI.

http://qbnz.com/highlighter/index.php

Much better than simply keeping indentation. It hilight source code syntax with colors for an incredible number of languages.


This is were  hughe communities of coder are incredibly good - thanks to all Drupaler and PHP guys and of course the GeSHI autors - you are great and you did my day !

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

Latest openerp all in one for windows ...

remember http://nightly.openerp.com !


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