Getting started with Odoo development in Ubuntu

I recently wrote a tutorial on How to install Odoo 11 on Ubuntu 18.04 and I just started the Odoo module development. I was looking at the Odoo’s official documentation and nothing was working for me, even the very first command i.e `odoo-bin` . Either the documentation is out of date or I am too stupid to understand it. Anyway in this blog post I am going to show how I setup my Odoo development environment on Ubuntu 18.04

As the official documentation suggest using odoo-bin , there’s not only that command available but also there’s no such file as odoo in /opt directory. So we are going to make our module in the directly of our choice, I made a directory with name odoo in my ~/Document :

$ cd Document

$ mkdir odoo

$ cd odoo

Now we are going to create our module in this directory, but instead of using odoo-bin we will simply use the odoo command. Odoo has an option scaffold which will help us set up our files, directories and sub-directories for our module.

$ odoo scaffold helloworld addons

(it will create `helloworld` in `addons` directory, the second directory name can be ommited)

It will make all these directories and files and fill it for you.

It will take only a second to setup a boilerplate for our own module, in this case our ‘helloworld’ module. As everything is set up, we only have to add our custom module path to the odoo configuration. By default the odoo config file is in ‘/etc/odoo/odoo.conf’ which looks like this

 
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_post = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python3/dist-packages/odoo/addons  

You can add your custom modules path in that one line separated by a comma like:

 
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_post = False
db_user = odoo
db_password = False
addons_path =  /usr/lib/python3/dist-packages/odoo/addons, /home/elliot/Documents/odoo/addons  

What I like to do is create a separate config file in my custom module directory with the same content (because I don’t want to mess with the default configuration files) and then fire up odoo with the option `--config` in that custom module directory. e.g `odoo start --config=odoo.conf -i helloworld`

Go to the browser and http://localhost:8069 and then navigate to Settings on top, on the right side you should see a panel ‘Share the love’ , ‘Activate the developer mode’

After activating the developer mode, navigate to ‘Apps’ , On the left sidebar ‘Update Apps List’

Search for your custom module from the top search bar, in my case which is ‘Hello World’ and tada:

2 thoughts on “Getting started with Odoo development in Ubuntu

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.