Chapter 3 - Odoo 15 Development Book

Module structure

While creating a module, it definitely has its own structure, and you should make sure that you have followed the module structure. A module comprises different components such as models, views, security, etc.

Mainly an Odoo module is declared by its manifest

All modules must have a python file and a manifest file that are __init__.py file and __manifest__.py file.

We can take a look at the structure.

odoo-crm

The basic structure of the module is shown above. Basically, the odoo module contains an __init__.py file and __manifest__.py file.

A module is also a Python package that includes a __init .py file that contains import instructions for the module's numerous Python files. For example, if the module has a single pythonfile.py file __init__.py might contain:

from . import pythonfile 

__manifest__.py

In the __manifest__.py, We have to describe the name of the module, author name, version, description, company, category, etc.

name - Name of the record.

description - Brief description of the module.

version- Specify the version of the module.

license - Specify the distribution license of the module.

author - Author name of the module.

website - Website URL of the module author.

category - Specify the category name.

depends -The list of modules that must install before installing the module.

Data - The files that are installed or updated with the module installation.

Demo - The data files that are installed or updated in active demonstration mode.

Also, the module has directories such as models, views, security, data, demo, static, wizards, etc.

Models

contain the backend code files, thus creating models and their logic. The model file contains __init__.py file, which imports all python files on that models directory.

Views

Views file contains the XML files for the user interface, with the actions and views like forms, lists, etc. The format of the xml file is “sample.xml “

Data

Data file contains all other data files with the module's initial data.

Demo

The demo contains data files with demonstration data, which is helpful for test, training, or module evaluation.

i18n

The i18n file contains the translation files. The .po and .pot files are contained on the i18n. These files need not be mentioned on the manifest file.

Security

It contains XML files that create access groups and record rules for security, as well as data files that define access control lists, such as the ir.model.access.csv file.

Controllers

The Controllers folder contains the code files for website controllers and modules that provide that functionality.

Static

All assets are expanded inside the static directory. The files in this directory are open to the public and can be accessed without a username and password. This directory contains items like javascript, style sheets, and images that aren't listed in the module manifest but must be referenced in the web template.

Wizard

Contains all of the files related to wizards. In Odoo, wizards are used to holding intermediate data.

Reports

Odoo provides a feature to generate pdf documents such as sales orders and invoices. This report directory holds all the files related to reports.

whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message