ODOO 10 CE – migration en version 11.0

/!\ Cet article est rédigé en anglais car il est référencé dans un échange sur github/OCA/OpenUpgrade .

I would like to test an upgrade from Odoo CE 10.0 to Odoo CE 11.0 with a simple database (Server 1 -> Server 2).

This upgrade will be done with OCA OpenUpgrade tool.

Server 1 :

Server 2 :

Step 1 - on Server 1

- connect to bash with odoo user on /odoo directory

python version

Python 2.7.9

python3 version

Python 3.4.2

- install pip3 and upgrade with latest version

sudo apt-get install python3-pip

sudo pip3 install --upgrade pip

- download OpenUpgrade

git clone https://github.com/OCA/OpenUpgrade.git

- install python requirements

cd OpenUpgrade

git checkout 11.0

sudo pip3 install -r requirements.txt

Error 1 : 2 errors appear during installation of these modules : lxml, pyldap (lxml was already installed with a latest version).

Solution 1 : I removed them from requirements.txt file

- install openupgradelib

sudo pip3 install --ignore-installed git+https://github.com/OCA/openupgradelib.git@master

- Compare set of installed modules with the modules that are covered by OpenUpgrade

cd ..

diff odoo-server/addons OpenUpgrade/addons/ | grep -v "Common subdirectories" | grep -v "OpenUpgrade"

Seulement dans odoo-server/addons: account_accountant
Seulement dans odoo-server/addons: account_tax_cash_basis
Seulement dans odoo-server/addons: base_action_rule
Seulement dans odoo-server/addons: crm_project_issue
Seulement dans odoo-server/addons: hr_timesheet_sheet
Seulement dans odoo-server/addons: marketing_campaign
Seulement dans odoo-server/addons: marketing_campaign_crm_demo
Seulement dans odoo-server/addons: portal_gamification
Seulement dans odoo-server/addons: portal_sale
Seulement dans odoo-server/addons: portal_stock
Seulement dans odoo-server/addons: procurement
Seulement dans odoo-server/addons: project_issue
Seulement dans odoo-server/addons: project_issue_sheet
Seulement dans odoo-server/addons: rating_project_issue
Seulement dans odoo-server/addons: report
Seulement dans odoo-server/addons: stock_calendar
Seulement dans odoo-server/addons: stock_picking_wave
Seulement dans odoo-server/addons: subscription
Seulement dans odoo-server/addons: web_calendar
Seulement dans odoo-server/addons: web_kanban
Seulement dans odoo-server/addons: website_issue
Seulement dans odoo-server/addons: website_portal
Seulement dans odoo-server/addons: website_portal_sale
Seulement dans odoo-server/addons: website_project
Seulement dans odoo-server/addons: website_project_issue
Seulement dans odoo-server/addons: website_project_issue_sheet
Seulement dans odoo-server/addons: website_project_timesheet
Seulement dans odoo-server/addons: website_rating_project_issue

- call http://<server1>:8069/web/database/manager and duplicate migr1 database to migr1_v11

- stop odoo

sudo service odoo-server stop

- start openupgrade

OpenUpgrade/odoo-bin --addons-path OpenUpgrade/addons --database migr1_v11 --update all --stop-after-init --logfile /tmp/migration.log

Error 2 occurs :

 File "/home/odoo/OpenUpgrade/odoo/addons/base/ir/ir_model.py", line 1499, in _update
" you can't define a `%s` record with this ID." % (xml_id, imd_model, model)
odoo.tools.convert.ParseError: "External ID conflict, report_ir_model_overview already refers to a `ir.actions.report.xml` record, you can't define a `ir.actions.report` record with this ID." while parsing /home/odoo/OpenUpgrade/odoo/addons/base/ir/ir_model_report.xml:9, near
<report id="report_ir_model_overview" string="Model Overview" model="ir.model" report_type="qweb-pdf" name="base.report_irmodeloverview" file="base.report_irmodeloverview"/>

Solution 2 - connect to migr1_v11 database and execute command :

delete from ir_act_report_xml;

- restart openupgrade

Error 3 occurs :

odoo.tools.convert.ParseError: "ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique « res_groups_name_uniq »
DETAIL: La clé « (category_id, name)=(12, Pro-forma Invoices) » existe déjà.
" while parsing /home/odoo/OpenUpgrade/addons/sale/security/sale_security.xml:48, near
<record id="group_proforma_sales" model="res.groups">
<field name="name">Pro-forma Invoices</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
2018-10-05 11:25:08,516 12695 CRITICAL migr1 odoo.service.server: Failed to initialize database `migr1`.

Solution 3 - connect to migr1_v11 database and execute command :

delete from res_groups where name = 'Pro-forma Invoices';

- restart openupgrade and wait until :

2018-10-05 11:33:22,671 12720 INFO migr1 odoo.modules.loading: Modules loaded.
2018-10-05 11:33:22,677 12720 INFO migr1 odoo.models: Computing parent left and right for table ir_ui_menu...

- restart odoo server

sudo service odoo-server start

- call http://<server1>:8069/web/database/manager and backup migr1_v11 database in zip file migr1_v11_2018-xx-xx.zip

- Click here to view migration logfile

Step 2 - on Server 2

- call http://<server2>:8069/web/database/manager and restore database from with name migr1_v11

- connect to odoo database migr1_v11 with admin user

Error 4 occurs :

Solution 4 - connect to migr1_v11 database (server 2) and execute command :

delete from ir_ui_view where name in ('web_calendar assets','web_kanban assets','report assets');

- stop odoo server

sudo service odoo-server stop

- update odoo server

./odoo-server/odoo-bin -u all -d migr1_v11 --stop-after-init

- restart odoo server

sudo service odoo-server start

Conclusion

Given the errors encountered, I'm not sure I used the best method of migration !!

Particularly, I didn't use migrate.py script because of this information :

https://doc.therp.nl/openupgrade/migrate.py.html

Références :
https://doc.therp.nl/openupgrade
https://github.com/OCA/OpenUpgrade
https://github.com/OCA/OpenUpgrade/blob/706c253f6ff2e41243346e632f1fd5335d36ab4c/odoo/openupgrade/doc/source/migration_details.rst
https://cier.tech/blog/blog-1/post/how-to-upgrade-odoo-with-automated-migration-script-15
https://leewayknowledge.blogspot.com/2018/07/how-to-upgrade-odoo-database.html

Todo
- use module database_cleaner

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée.