How to do it...

The following steps will create and install a new addon module:

  1. Change the working directory in which we will work and create the addons directory where our custom module will be placed:
$ cd ~/odoo-dev
$ mkdir local-addons  
  1. Choose a technical name for the new module and create a directory with that name for the module. For our example, we will use my_module:
$ mkdir local-addons/my_module


A module's technical name must be a valid Python identifier; it must begin with a letter, and only contain letters (preferably lowercase), numbers, and underscore characters.

  1. Make the Python module importable by adding an __init__.py file:
$ touch local-addons/my_module/__init__.py
  1. Add a minimal module manifest for Odoo to detect it. Create a __manifest__.py file with this line:
{'name': 'My module'}    
  1. Start your Odoo instance including our module directory in the addons path:
$ odoo/odoo-bin --addons-path=odoo/addon/,local-addons/    

If the --save option is added to the Odoo command, the addons path will be saved in the configuration file. Next time you start the server, if no addons path option is provided, this will be used.

  1. Make the new module available in your Odoo instance; log in to Odoo using admin, enable the Developer Mode in the About box, and in the Apps top menu, select Update Apps List. Now, Odoo should know about our Odoo module.
  2. Select the Apps menu at the top and, in the search bar in the top-right, delete the default Apps filter and search for my_module. Click on its Install button, and the installation will be concluded.