Notes on migrating Odoo from 11 to 12

These are mostly notes to myself, as it’s a somewhat involved process, and the documentation is not very useful. I had to puzzle-piece it together from dozens of form posts and questions, so I hope that this overview will be helpful to others.

Overall process

Odoo does not have an automatic database update when changing between major versions (however, it seems when updating within the same version, the database is adapted and won’t work with older versions).

To update major versions, two parts have to be updated:

  • the code: that’s the easy part, simply uninstall the old version and install the new version. In Ubuntu, I used the apt package manager to uninstall, then updated the repository (odoo nightly builds) from 11 to 12, apt-get update, and apt-get install odoo again.
  • the database: This is the hard part. One way is to switch to the paid enterprise version, and simply let the people at Odoo handle it for you. There are also consulting companies that will do an update against a fee. Or, the DIY method (that this blog is all about…), is to use OpenUpgrade. There are a few pitfalls though.

OpenUpgrade process

OpenUpgrade is a tool that is supposed to take your old database and convert it to the newer version of Odoo.

OpenUpgrade Tip #1: The documentation is bad – very thin on details, outdated, and very confusing. Also, when you look through the github issues, ignore the maintainers who tell people to just go and read the documentation, and insist it’s all there, without offering any help. It’s not, and their attitude is a bit off-putting. Pro-tip: if many people ask “stupid” questions, maybe your documentation isn’t good enough.

The main problem: Apparently there used to be a “migration script”, and a lot of forum posts and tutorials refer to it. It doesn’t exist any more, as it was removed due to too many bugs, according to what I’ve read in the issues. This is not mentioned anywhere.

The way it works now: OpenUpgrade appears to be basically just another patched version of Odoo, with a built-in migration tool. You run it, as you’d run the Odoo server, point it at your database with a few flags, and if all is good, it should update your database. So the overall process is:

Create a local backup instance: (never run an update on your live system!!)

  • install Odoo on a dev machine (not your live system). Make sure you’re running the exact same version of code you’re running on your live system, or the database probably won’t work.
  • download a database dump from your live system, and import it into your dev instance. This can be done either through the web interface (http://localhost:8069/web/database/manager ), or via command line (e.g. instructions here ). You also should transfer the file store and add-ons to your dev machine. On Ubuntu, the file store is in /var/lib/odoo/.local/share/Odoo
  • test your dev setup, and make sure your data is all there and works. You might have to check if all needed apps are installed on your dev server.
  • At this point, it’s maybe a good idea to deactivate/uninstall all apps you don’t actually use, to avoid problems during the upgrade.
  • At this point, I used the web database manager to create a duplicate of my database, called “migration” (optional, but it’s good to work on a copy).

Install and run OpenUpgrade:

  • stop the Odoo service (service odoo stop)
  • get OpenUpgrade ( git clone )
  • check out branch 12.0 when upgrading from 11 to 12: git checkout 12.0 (you can only upgrade one version at a time).
  • install the newest version of the OpenUpgradeLib (as root): sudo pip3 install --ignore-installed git+
  • run OpenUpgrade as the Odoo user with the following flags
    • sudo -u odoo ./odoo-bin -d migration --update all --stop-after-init --data-dir=/tmp (-d gives the database name, in this case called “migration”. I had to set the data dir to /tmp, as the odoo user didn’t have permissions to write in my home folder).
  • There will probably be some errors. In my case, I had some missing python packages, or outdated versions. I installed the newest versions with pip3, in particular psycopg2 and sql. Funnily, although the debian package version of Odoo runs without problem, the OpenUpgrade version didn’t have everything it needed. Also, when using pip to install packages, install them system-wide with sudo, otherwise the odoo user won’t find them.
  • Update: I also got an error “Couldn’t load module auth_crypt”. I uninstalled odoo 11 and installed version 12 (see steps below), and that fixed the error for me.
  • if everything goes well, this should run for a few minutes, giving lots of “INFO” output, and terminate when it’s done. The database should now be updated to the newer version.

Install Odoo v12, and test the migrated database:

  • uninstall version 11 of odoo: sudo apt-get remove odoo
  • edit the repository (/etc/apt/sources.list.d/odoo.list) from 11.0 to version 12.0 (it should look like deb ./ )
  • sudo apt-get update
  • sudo apt-get install odoo
  • open http://localhost:8069/web/database/manager
  • your “migration” database should now appear without an exclamation mark. Select it and try it out. It should work now in version 12. Make sure to test everything thoroughly, before updating your live system and migrating the new database and files back.
  • on the second try (March 2020) I had a bug that none of the login passwords worked any more. I reset the admin password in the database (make sure you get an “UPDATE 1” as confirmation):
# update res_users set password='test' where login='your_login_name';

This is it. It might take a while to get it running, but it ported all my data across (I think). I hope this detailed step-by-step guide helps.

5 Replies to “Notes on migrating Odoo from 11 to 12”

  1. Hi,
    first of all thanks for your guide, it helps me alot to try understand how works openupgrade.

    I’m working in a windows enviroment and I’m trying to upgrade from odoo 10 to odoo 11.

    I have a question for you, when you use the odoo user is this one user that exist in the database to migrate or it is a default user.

    If I try with odoo say me that no password sulpied

    And I try with db user or odoo user it shows:

    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

    Thanks for your help

    1. In this case I mean the linux user named odoo. I think (from memory), the way it’s set up in Ubuntu is that a new system user “odoo” is created, that has access to the database without further authentication. That’s what the “sudo -u odoo” does – run the code under the username odoo. I don’t know how it is on a windows environment. On other systems, the username could also be different.

  2. Hi,
    thanks for your atention.

    When I execute the migration It show this:
    C:\Program Files (x86)\OpenUpgrade-11.0>python odoo-bin -d BtoBsolutions –update all –stop-after-init –data-dir=c:\temp -u openpg -w pass

    2020-04-07 15:15:35,642 1080 INFO ? odoo: Odoo version 11.0

    2020-04-07 15:15:35,642 1080 INFO ? odoo: addons paths: [‘c:\\temp\\addons\\11.0’, ‘c:\\program files (x86)\\openupgrade-11.0\\odoo\\addons’, ‘c:\\program files (x86)\\openupgrade-11.0\\addons’, ‘C:\\

    Program Files (x86)\\OpenUpgrade-11.0\\odoo\\addons’]

    2020-04-07 15:15:35,642 1080 INFO ? odoo: database: default@default:default

    2020-04-07 15:15:35,657 1080 INFO ? odoo.sql_db: Connection to the database failed

    Traceback (most recent call last):

    File “odoo-bin”, line 8, in


    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\cli\”, line 60, in main

    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\cli\”, line 175, in run


    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\cli\”, line 140, in main


    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\service\”, line 95, in _create_empty_database

    with closing(db.cursor()) as cr:

    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\”, line 637, in cursor

    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)

    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\”, line 178, in __init__

    self._cnx = pool.borrow(dsn)

    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\”, line 520, in _locked

    return fun(self, *args, **kwargs)

    File “C:\Program Files (x86)\OpenUpgrade-11.0\odoo\”, line 588, in borrow


    File “C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\psycopg2\”, line 127, in connect

    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)


    I think that probably the error is because it try to connect to a non exist database:

    2020-04-07 15:15:35,642 1080 INFO ? odoo: database: default@default:default

    I would change any conf file?

    Thanks in advance

    1. Hi,

      sorry, I can’t really help you with this problem. I’ve never installed Odoo on a windows system, and don’t know how it works there. It’s probably best to look for help on Odoo forums, or the OpenUpgrade project.

  3. Hi, thank you for this post.
    Im working in migrate odoo 9 to odoo 10, but I got this error “ImportError: cannot import name sql”
    It is related with …… from psycopg2 import sql

Leave a Reply

Your email address will not be published. Required fields are marked *