How to upgrade Odoo with automated migration script

Upgrade your Odoo for free

1. What is it about?
This article will guide you how to upgrade your Odoo instance using a free automated script. You can upgrade any version - for example Odoo 9.0 -> Odoo 10.0, Odoo 10 - Odoo 11. The tutorial was made as simple as possible(even database was restored from Database Manager). However, some skills are required. Please note that if your current Odoo instance has many custom modules using the script would not be enough. In that case, I would recommend using OpenUpgrade Documentation.
Ready? Let's get started :)

2. Checklist

- Odoo installed on Ubuntu server (in this tutorial I am using Odoo9 installed on Amazon EC2 Ubuntu 16,04)
- access to bash
- fresh Odoo install, where migrated version will be set(you can use this tutorial on how to install Odoo)
- please backup your server prior to running through this tutorial
- basic IT skills ;)

3. Migration

3.1 Firstly download the migration script:

 wget https://raw.githubusercontent.com/OCA/OpenUpgrade/HEAD/scripts/migrate.py

3.2 Now you need to know three things to properly run the script:


1) Where is your Odoo config file stored



In this case, it is just in /etc/odoo-server.conf - write it down somewhere as you will need it soon

2) What is your the name of the database you want to migrate? There are many methods on how to check it - if you are not too tech savvy simple log into Database Manager (www.yourodooinstance/web/database/manager)


As you can see in this case it is "test". Write it down.

3) What version do you want to migrate to? 9.0, 10.0, maybe 11.0? It is up to you.

3.3 Time to run the script

python migrate.py --config=/etc/odoo-server.conf --database=test --run-migrations=10.0

The script will rebuild your Odoo 9.0 and produce a backup file that you can import into Odoo 10 instance.



Once it is done please check the log file to see if there are any issues(I know most of the people won't bother with it).

vi /var/tmp/openupgrade/migration.log

3.3 Download the backup file

Your migrated Odoo is ready and waiting in the Database Manager. Simply download it and restore in another Odoo instance.


4. Possible errors and fixes

Some things might go wrong. The following solutions won't necessarily work in every single case. There are thousands of them. I have listed just the most common issues

1) "File exists":

rm -rf /var/tmp/openupgrade

2) Configparser error:

pip install future
sudo apt-get install python-configparser

3) "Error user access":

in etc/postgresql/your version/pg_hba.conf add:

local all odoo trust

then:

service postgresql restart

4) "Peer access error":

As in point 3) simply update pg(remember to change it back to the previous state after migration)

local   all             postgres                                md5

5) Openupgrade missing module:

pip install openupgradelib

If you want to access postgres:

sudo su - postgres

5. References

I have used the following resources:

Official documentation

https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge

https://github.com/OCA/OpenUpgrade/issues/152

http://www.postgresqltutorial.com/postgresql-list-users/

https://askubuntu.com/questions/413585/postgres-password-authentication-fails

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-14-04

https://www.odoo.com/es_ES/forum/ayuda-1/question/how-do-i-start-using-an-openupgrade-migrated-database-in-odoo-75957

https://www.odoo.com/es_ES/forum/ayuda-1/question/why-do-i-get-a-role-does-not-exist-error-after-openerp-installation-824

https://dba.stackexchange.com/questions/1285/how-do-i-list-all-databases-and-tables-using-psql

Important. Migration Script, as well as migration software, is provided by Odoo Community Association. If it was useful for you should consider the donation to OCA, see how you can contribute in OCA. Feel free to contact me for more help. I do work on migrations and updates(in case of migration there would be a charge).