Odoo 10 Development Tutorial: Installation

02: Local Development Environment Setup

ProjoMania, Mohamed Magdy Mahmoud


As a developer, you should have a well built development environment that helps you to work on different projects for different versions of Odoo with no python packages conflicts and to have the ability to move from one project to another easily.

The perfect Odoo development environment should have:

  • Ubuntu 16.04.2 Desktop LTS (Download). Ubuntu is recommended for its simplicity and the strength of its community.

  • PyCharm Community Edition (Download) with Odoo PyCharm Templates (Download).

  • Virtualenvwrapper

  • Git tools to enable you to clone Odoo repository and to be able to pull updates and fixes whenever you need.

Assuming that you have a fresh installation of Ubuntu, you can start Odoo installation:

Tools Installations

Install git tools

Git is a great tool that helps the developers to be aware of the project progress and log every single detail about the written code with commit messages and branches. These standards will be applied in the tutorial as much as possible. But you still can have a quick look here.

By installing git, you will be able to clone, push, pull commits.

sudo apt-get install -y git

But it can be even easier for you when it come to build your own repositories in a professional way to be shared in the community. git-flow is the right tool for this mission, you can instal it now and we will back to it later when building our first module.

sudo apt-get install -y git-flow

When building a massive module, it become confusing to have many branches which my cause modifying other branches accidentally. So, it is highly recommended to use Git Aware Prompt tool. The installation on Ubuntu will be summarized here, but you still can use the documentation for installation in other distributions.

Run the commands in your terminal:

mkdir ~/.bash
cd ~/.bash
git clone git://github.com/jimeh/git-aware-prompt.git
gedit ~/.bashrc

Add the  following lines to the end of the file:

export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "

Enjoy it!

Download and Install PyCharm CE

PyCharm CE is an IDE for Python, it is fully featured. It can be used for different Python projects like Odoo, Django and more. 

You can download PyCharm CE here. Extract the downloaded file, then navigate to the bin folder where you will be able to find the script pycharm.sh.

Just run it using the terminal:

PyCharm CE should launch and you will get a similar splash screen where you can Create Desktop Entry so that you can launch PyCharm CE using the Unity Launcher just like any other installed application.

P.S: You might be asked for your Super User password.

Configure Odoo PyCharm Templates

After getting your PyCharm CE installed, you will be ready to make your Odoo Development experience easier with Odoo PyCharm Templates. All you need is the file Odoo.xml to be placed in the directory:


NOTE: The PyCharm directory can differ for different version of installed PyCharm. So, to generalize it:


Just restart PyCharm CE and get fun with Odoo PyCharm Templates.


Install virtualenvwrapper

Odoo is a python web application that needs many python modules to up & run which seems great until you start to develop different module for different versions of Odoo. Installing different versions of Odoo means that you'll face the issue of python package conflicts.

This problem can be solved either using a virtualenv or the usual virtual machines. For Odoo, it would be much better to use virtualenv specially it is fully integrated with PyCharm CE which enables you to manage your virtual environments for different Odoo versions.

Your Ubuntu might not have pip, so you need to install it:

sudo apt-get -y install python-pip

or it might be there but you just need to make sure that you have the latest version:

sudo pip install --upgrade pip

Now, let us start with installing virtualenv:

sudo pip install virtualenv

Then, create a directory where all your virtual environments will be located:

mkdir ~/.virtualenvs

Now, you're ready to install virtualenvwrapper:

sudo pip install virtualenvwrapper
export WORKON_HOME=~/.virtualenvs

Open the ~/.bashrc file:

gedit ~/.bashrc

to add this line at the end of the file:

. /usr/local/bin/virtualenvwrapper.sh

For more details about the installation of virtualenvwrapper, you can refer to this page.

Setup the directories

The most important thing about your projects is to keep things organized, so I will try to help with this.

In your home direcotory, create a folder "OdooProjects" where your odoo projects will be saved.

mkdir ~/OdooProjects

Then, move to this folder:

cd ~/OdooProjects

And create a directory per Odoo version, for example:
If you have projects for Odoo 8.0, 9.0 and 10.0, then you will need a directory per version as following:

mkdir Odoo_8 Odoo_9 Odoo_10

As this tutorial is about Odoo 10.0, then you will move inside the directory Odoo_10 to start your environment setup:

cd Odoo_10

This folder will contain all of your Odoo Projects as well as the Odoo source code

While you can get Odoo 10 directly from the official website as compressed ZIP file, but it is not recommended for a developer who may need to have update for new features and bug fixes. Let us clone it:

git clone https://github.com/odoo/odoo.git --branch 10.0 --single-branch --depth 1

This should take a few minutes :) ;)

Install Dependencies 

After geting Odoo 10 source code, you will need to install the dependencies:

sudo apt-get install -y postgresql posgresql-server-dev-9.5 nodejs npm python-lxml libxml2-dev python-ldap libldap2-dev python-dev build-essential libssl-dev libffi-dev libxslt1-dev zlib1g-dev libsasl2-dev

By installing postgresql, you should create the user who will responsible for the connection between Odoo and your DB. So, run these three commands:

sudo su - postgres
createuser -s YOUR_USERNAME

As Odoo 10.0 is using nodejs, you will need to install some packages using Nodejs Package Manager (npm)

sudo npm install -g less less-plugin-clean-css
sudo ln -s /usr/bin/nodejs /usr/bin/node

Finally, you will need to install wkhtmltopdf that can be downloaded for amd64 or i386. After downloading it, Double-Click on the downloaded file and follow the instructions. You might be asked for your super user password.

Odoo image and text block

Create a virtual environment

As shown in the screenshot, you can start with creating a separate virtual environment for your Odoo 10.0 projects where specific versions of Python packages will be installed.

You can create the virtual environment using this command:

mkvirtualenv Odoo_10

You can not the name of the virtual environment in the prompt.

Navigate to the Odoo 10 folder

By moving to the Odoo 10 folder, you will find a new notifier in the prompt :
If you installed Git Aware Prompt, you should have the same notifier that telling you which branch you're using now.

Odoo text and image block
Odoo image and text block

Python Dependencies Installation 

As mentioned earlier, different Odoo versions will use different versions of python packages. To be sure, that you're having the right versions of python packages you can use this command:

pip install -r requirements.txt

Then navigate to the directory /doc under odoo where you can find another requirements.txt file to be installed too:

cd doc
pip install -r requirements.txt

Start Odoo 10.0 server

By following the mentioned steps, you should be able to use the script odoo-bin to start Odoo 10 server using the virtual environment:
./odoo-bin --addons-path=addons

Odoo text and image block
Odoo image and text block

A new DB for testing the installation

To make sure that everything went okay, you can create your first demo DB as shown in the screenshot.  

Leave a comment

You must be logged in to post a comment.