How to do it...

As an example for this chapter, we will create a small add-on module for managing a list of the books for the library.

The following steps will create and install a new add-on module:

  1. Change the working directory in which we will work and create the add-ons 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_library:
$ mkdir local-addons/my_library
A module's technical name must be a valid Python identifier; it must begin with a letter, and only contain letters, numbers, and underscore characters. It is preferable that you only use lowercase letters in the module name.
  1. Make the Python module importable by adding an __init__.py file:
$ touch local-addons/my_library/__init__.py
  1. Add a minimal module manifest for Odoo to detect it as an add-on module. Create a __manifest__.py file with this line:
{'name': 'My Library'}
  1. Start your Odoo instance, including our module directory, in the add-ons path:
$ odoo/odoo-bin --addons-path=odoo/addon/,local-addons/
If the --save option is added to the Odoo command, the add-ons path will be saved in the configuration file. The next time you start the server, if no add-ons 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_library. Click on its Install button, and the installation will be concluded.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset