Organizing the add-on module file structure
An add-on module contains code files and other assets, such as XML files and images. For most of these files, we are free to choose where to place them inside the module directory.
However, Odoo uses some conventions on the module structure, so it is advisable to follow them.
Getting ready
We are expected to have an add-on module directory with only the __init__.py
and __manifest__.py
files. In this recipe, we assume this is local-addons/my_library
.
How to do it...
To create a basic skeleton for the add-on module, perform the following steps:
- Create directories for the code files:
$ cd local-addons/my_library $ mkdir models $ touch models/__init__.py $ mkdir controllers $ touch controllers/__init__.py $ mkdir views $ touch views/views.xml $ mkdir security $ mkdir wizard $ touch wizard/__init__.py $ mkdir report $ mkdir data $ mkdir demo $ mkdir i18n
- Edit the module's top
__init__.py
file so that the code in...