Introduction

openerpAs we all know, OpenERP is very interesting system, but the quality and ability to migrate between versions are the big issue.

As many in the net, I would prefer to be independent rather than making payments for so called “support” and that was why I was looking my db migrations methods. Here I describe how I have done the task for migration from v.6.0.3. to v.6.1.

As my previous experience in migration from 5.0.x to 6.0.1 shows that it is a bit complex system, this time I decided to use more information about migration from different sources as follows:

General To Do list:

To migrate from V6.0.3 to V6.1.1, we need to have a migration script for each table in our actual database. Usually, OpenERP team provides such a script for all those modules (tables) which are supported by the team. If you have many custom modules or you use something what was developed for you, it looks like those data cannot be migrated by the OpenERP team and they might ask you to contact those who developed those custom modules.

So, as there are plenty of modules in the net, you might need more solid approach. My choice was to use the community solution, which is called OpenUpgrade server. In our case we need to use OpenUpgrade server version 6.1, which you can get from Bazaar.

Basically, in order to create the migration code one need to do the following:

  • checking out the addons and server of V6.0.x,
  • get the difference in tables and provide database script which converts data from version 6.0.x into 6.1,
  • Analyze the module code in some cases do the merge between the code you have and the code from new version. If it is your module, you might not need to change any code or you simply need to adopt the code to work with new database schema. 

After you prepare the migration code, here are steps for database:

  • Make a copy of existing db, disable all the customized modules including yours and ones from community
  • Run pre-SQL scripts to fix all the known errors;
  • Start server with --database=dbName --update=all;
  • Install your customized modules or extra-addons from community one by one, or all in once with --database=M1 --init=m1,m2,m3...
  • Run post-SQL scripts to fix all the errors introduced by your customized modules;
  • Start server with --database=dbName --update=all;
  • Manual configuration if necessary;
  • Full user acceptance testing;

Setup migration configuration in Ubuntu 12.10

In order to run the migration, we are to build the migration script. Usually, if you have an active contract with OpeneERP, they produce it for you. However, my choice to use the community way – the system is called “OpenUpgrade Server”

Prerequisites

In order to setup OpenERP UpgradeServer, we need to install several packages as pre requisites as follows:

  • lxml
  • mako
    In order to install mako, just run the command as follows:
    \scripts\easy_install mako
  • python-dateutil
  • psycopg2
  • pychart
  • pydot
  • pytz
  • reportlab
  • caldav
  • pyyaml
  • pywebdav
  • feedparser
  • [SSL] pyopenssl
  • PIL – Python image library, from here.
  • Babel – from here.
  • PyWebDAV version 9.4.1, as per the post.

Note: currently available PyWebDav version 9.8… doesn’t work in Ubuntu 12.10 (Jan-2013)!!!

I spent a lot of time to find out that it is the case of my problems. But you can easily fix such a problem by removing the currently available version of the module for Ubuntu 12.10 by typing the following command:

sudo apt-get remove –purge python-webdav

or if you instyall it from easy_install by the command as follows:

pip uninstall PyWebDAV

and right after you can download the new package from here (I selected the one for Ubuntu 12.04) and install it as a regular deb package.

After such reinstallation, it works!!! Please don’t change/upgrade it at system update process!!! Even on Ubuntu 13.04 the problem is still here. Please keep not upgrading PyWebDAV if you want to keep your system working.

OpenUpgrade Server installation

In order to work with OpenUpgrdae server, you need to get it from Bazaar (install Bazaar explorer on your system before you do anything with LaunchPad). You can easily install “Bazaar Explorer” from “Ubuntu Software Center”.

The short instruction how you can use OpenUpgrdae Server for migration from OpenERP ver.6.0.3 to ver.6.1 was written here –  “Instructions and step-by-step commands for doing the upgrade from 6.0 to 6.1 (How to)”, and based on the guide I provide my step-by-step sequence as follows:

  • Make a full DB backup with OID by using pgAdmin III.
  • Stop your 6.0 servers (or just openerp-server, like in my case):
    sudo service openerp-server stop
    sudo service openerp-web stop
  • Install Bazaar explorer from “Ubuntu Software Center” or just type the command as follows:
    sudo apt-get install bzr
  • Get OpenUpgrade Server from Bazaar, by using command line as follows:
    bzr branch lp:openupgrade-server/6.1

    image
    or from the Bazaar GUI (see the picture above for details):
  • go to File->Open location and type there the same address:
    lp:openupgrade-server/6.1
  • Now you have to go into Bazaar->All Commands and select the working directory in your computer, where you plan to download the server
  • in Command, select
    branch
  • In Options and arguments for command, specify the same address for the server as follows:
    lp:openupgrade-server/6.1
  • And click ok to download the code
  • Get OpenUpgrdae addons by using the command line as follows:
    bzr branch lp:openupgrade-addons/6.1
    or the same step-by-step sequence as it was provided for the server.
  • After my first migration attempt, I found that there is another repository in the LaunchPad which is very usefun for our needs, which is OpenUpgrdae addons-extra-6.1. You can get it by using the command as follows:
    bzr branch lp:~openupgrade-committers/openobject-addons/openupgrade-extra-addons-6.1
    or by using the same sequence in the Bazaar GUI as it was described above.
  • As soon as you get all files, you can create a directory on your Linux machine, like this one:
    mkdir /opt/openerp
  • Now you can move what you downloaded from temporary location in newly created ones.
    sudo mv openupgrade-server /opt/openerp
    sudo mv openupgrade-addons /opt/openerp

Finally, you can manually copy or move those addons from openupgrade-extra-addons-6.1 into the /opt/openerp/openupgrade-addons directory, which you use. In my opinion, don’t copy or move all, otherwise you can face with migration errors as each addon has a migration script which contains several checks for data integrity and the migration script itself. I suppose, that the use good enough number of modules is something which guaranty you the successful migrartion.

The migration

In order to start the migration , you are to run the OpenUpgrade Server with parameters as follows:

/opt/openerp/openupgrade-server/openerp-server \
      –config=/etc/openerp-server.conf \
      –stop-after-init \
      –log-level=debug \
      –database=’’ \
      –u all \
      –addons-path=’/opt/openerp/openupgrade-addons’ \
      -r  ‘’ \
     -w ‘

Notes:

  • As you can see here, –u all flag defined that all databases should be updated
  • –stop-after-init flag we need in order to run the migration and don’t keep running the server when the migration is completed,
  • --addons-path is to specify where addons are located,
  • -r – we need this flag if we want explicitly define database use for the connection,
  • -w is to define explicitly database use password for the connection.

    As soon as you see that the command ends without interruptions, the migration process is done. In my case I saw several problems, for example the migration stops at fetchmail module migration with primary key violation error. In order to go further, I just moved out from addons directory the directory called fetchmail.

I got some problems with account_move checks and just adjusted check conditions in account\account_asserts_test.xml file according to my case.

Post migration activities

Remove module “account_tax_include”

You can read full details about the activity in a separate post here.

Reporting system bug fixing

You can read full details about the activity in a separate post here.

Removing account_invoice_payment_terms module

You can read full details about the activity in a separate post here.

Removing account_financial_report module

You can read full details about the activity in a separate post here.

Fixing/setup “BVR Invoice” report for those who live in Switzerland

You can read full details about the activity in a separate post here.

BVR Invoice out of the box report doesn't support Swiss standards for BVR form, so it is required to customize the "BVR Report" in order to use it in real life. I create additional post in order to explain how it was done in our case.

How to fix bugs at report printing/creation?

I created a separate post where I describe concrete cases with bugs and how you can fix such bugs. The post is here.

You cannot log in by using existing users, how can you fix it?

This is a well known bug #908875, here you can read more how you can fix the issue.

Fixing CRM module

When I use CRM module, I got an error message each time I manage stages of leads and opportunities. This post explain how I fixed the problem and I give you advice how you can use CRM with several sales teams.

Fixing Fiscal Year Wizard

As you start closing old year, we will be forced to use “account/wizard/account_fiscalyear_close.py” file, which is in particular contains “Generate Fiscal Year Opening Entries” wizard and others tools. In my case, the aforementioned wizard simply didn’t work, so I was forced to find a solution to fix it. Here, you can read more details about this.

I update the post if something new is required to be mentioned…

About Us

Out Mission

Our mission is to fill the gap between modern technologies and real life experience.

Our Goal

Together with our customers gain in revenue and business efficiency by using cutting-edge technologies.

Payment Methods

We are using secure Paypal & Money-bookers payment method as well as wire transfer. You can pay directly form your Credit Card via Moneybookers or Paypal and NEVER store your card information on our site

Contact Us

Address : Chemin Vert 9, 1804 Corsier-sur-Vevey, Canton Vaud, Switzerland
Phone : +41 (21) 522.07.20