How to manage Odoo addons on server deployed by CR&D Deploy script

Overview

In this article i will try to describe how to properly manage third-party addons on Odoo servers deployed by CR&D Deploy script and thus managed by odoo-helper-scripts. What i say manage addons, i mean that it includes following operations:

  • Install third-party addons on the server
  • Upgrade third-party addons on the server
  • Uninstall third-party addons on the server

Most frequently used operation is upgrade of addons (when you receive updateed versions of addons from developers and want to apply changes to your server).

I will use our Bureaucrat Helpdesk Lite repository to illustrate whole process of management of third-party addons on server managed by odoo-helper-scripts. So, in this article we will try to do following:


Prerequisites

Before we start, let's assume following:

  • We have access to server via SSH
  • We are able to use sudo to run commands as superuser
  • There is Odoo installed on this server via CR&D Deploy script


Installation of third-party addons

Installation of third-party addons is pretty simple. All you need is just run command

odoo-helper fetch https://github.com/crnd-inc/bureaucrat-helpdesk-lite

This command will automatically do following:

  • Clone repository into /opt/odoo/repositories/crnd-inc/bureaucrat-helpdesk-lite
  • Create symlinks for all modules in this repository in /opt/odoo/custom_addons folder. This is needed to make modules in this repository available in Odoo, because /opt/odoo/custom_addons folder is in addons_paths configuration parameter, thus Odoo will check this folder for addons.
  • Check if there is requrements.txt file inside this repo (or in any addons in this repo) and install python dependencies from that file.
  • Check for odoo_requirements.txt or oca_dependencies.txt files and apply operations above for each repo mentioned in these files.

After this step, you will be able to install addons from clonned repository in your database on the server.

But also, there is ability to install all modules in repo for each database from command line. Just run:

odoo-helper addons install --dir /opt/odoo/repositories/crnd-inc/bureaucrat-helpdesk-lite/

and Odoo helper will install all modules found in /opt/odoo/repositories/crnd-inc/bureaucrat-helpdesk-lite/ directory in each database on the server. If neede you can specify in what databases you want to install modules. For more info check the documentation of odoo-helper-scripts.

Upgrade of third-party addons

First of all, do not forget to take backup before upgrade.

Usually ,when you need to upgrade addons from repository clonned via git (as in our previous example), following steps have to be done:

  • Change current working directory to path where repository is clonned (in installation deployed via CR&D Deploy, usually it is somewhere inside /opt/odoo/repositories/ folder.
  • Make git pull for that repository. Be careful, ensure that pull operation succeded on the repo.
  • Link this repository (thus odoo-helper will create symlinks for all new addons in this repo). 
  • If addons in this repository depends on addons in other repositories, then apply previous operations to that repos too.
  • Run update for all addons in this repo (and in repositories this repo depends on) as single command.

In our case, Bureaucrat Helpdesk Lite depends on following repositories (mentioned in odoo_requirements.txt file):

Thus, we have update that repos too. This is needed because all addons on the server MUST be consistent (have compatible versions). The only way to achieve it is to always use latest versions of old addons. Thus, when we update helpdesk lite, we also need to update repositories it depends on, because new version of helpdesk lite may depend on some functionality in dependencies that is not available in older versions of dependencies.

So, summarizing mentioned above, we have to run following commands:

cd /opt/odoo/repositories/crnd-inc/bureaucrat-helpdesk-lite
git pull
odoo-helper link .   # . (dot) here means current directory
cd /opt/odoo/repositories/crnd-inc/crnd-web
git pull
odoo-helper link .  # . (dot) here means current directory
cd /opt/odoo/repositories/crnd-inc/generic-addons
git pull
odoo-helper link . # . (dot) here means current directory
cd /opt/odoo/repositories/crnd-inc/bureaucrat-knowledge
git pull
odoo-helper link .  # . (dot) here means current directory
# Next we have to update list of addons for each database on the server.
# This is needed to allow Odoo to update addons in correct order.
# Some times this command may fail (when new version of modules updates some system models), but do not warry.
odoo-helper addons update-list
# Next we have to run upgrade for all addons in mentioned repositories.
odoo-helper addons update \
--dir /opt/odoo/repositories/crnd-inc/bureaucrat-helpdesk-lite \
    --dir /opt/odoo/repositories/crnd-inc/crnd-web \
    --dir /opt/odoo/repositories/crnd-inc/generic-addons \
    --dir /opt/odoo/repositories/crnd-inc/bureaucrat-knowledge


After this, all addons in this repositories will be updated.

Also, if pull command in some repo did not introduce new changes, there is no sense to update addons in that repo.

Uninstallation of third-party addons

Usually, uninstallation of third-party addons is done via web user interface.

Physically, addon could be removed from server only when there are no databases that use such addon.


The End

I hope this article was helpful.

Also, i would like to add link to documentation on frequently used odoo-helper commands. There you can find more about how odoo-helper-scripts could make your life easier.


How to translate Odoo
Instruction of adding or modifying translations of particular module in particular database