How to update Odoo from GitHub
Update your Odoo in 4 steps
It is important to run the latest version of Odoo. Odoo Developers are constantly updating, fixing and upgrading the supported versions(Current and two previous iterations). This tutorial will guide you through all of the steps that are needed to update Odoo to the latest version. Please don't confuse update with an upgrade - upgrade is a more complicated process (see the post on how to upgrade Odoo). As always before doing anything please make sure that you have a backup.
The current updates of the Odoo can be checked on the Odoo
1. Connect to the server and stop Odoo
Firstly stop the Odoo(especially if you run it as a service):
sudo service odoo-server stop
Now go to the folder where Odoo is installed. As in this case, Odoo was installed in /odoo/odoo-server/ I used the command:
cd /odoo/odoo-serverIf you are not familiar with Linux command here are the couple useful ones:
cd folder - go to the "folder"
cd .. - goes down by one folder(exit current folder)
2. Do the Git Fetch
In this step, you will tell the system that you want to fetch the current folder with GitHub. Use the command:
sudo git fetch origin 12.0
You would like to change the version of Odoo. For example, if you are using Odoo 10 it would be:
sudo git fetch origin 10.0
3. Do the Git reset
Now is the time to apply the update from point 2. The system will update the code to the latest version. Please remember that if you have done a lazy coding - for example, you have changed the original code instead of making a module it will be wiped out;)
To do the Git reset please use the code:
sudo git reset --hard origin/12.0
Like in point 2 please change the version of your Odoo. For the Odoo 10 code would look like:
sudo git reset --hard origin/10.0
After a while, you will be able to see what version Odoo was updated to. You can compare it to the Odoo Runbot.
4. Restart and update Odoo
This is the last part. The database will be updated and Odoo restarted. The sample code would look like:
sudo service odoo-server restart -u -all -d ciertech
Changes to be made in the code:
5. Can't see new features?
sudo su - odoo -s /bin/bash
Now do the reset again:
./openerp-server -u all -d <db_name>
Good to know...
- Always make a backup, especially if you are working over someone else's code.
After update modules developed by you won't be affected
If you have done any changes to the original code they will be replaced by original Odoo code
if you followed the official deployment documentation you might need only the following line to update:
sudo apt-get upgrade odoo
References - this post is basing on the knowledge from the following sources:
- Official Odoo Documentation (https://www.odoo.com/documentation/11.0/index.html)
- Updating your Odoo from Github by Yenthe Van Ginneken (https://www.odoo.yenthevg.com/update-odoo-environment-github/)
For an automated update, you can create a script on the server to run automatically all of the mentioned points.