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. Proper code improves readability, eases maintenance, helps debugging, lowers complexity, and promotes reliability. These apply to every new module and all new developments.
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_hostel
.
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_hostel $ mkdir models $ touch models/__init__.py $ mkdir controllers $ touch controllers/__init__.py $ mkdir views $ touch views/views.xml $ mkdir security...