Development Book V17: Module Structure

The most important aspect of developing a module is its structure. When we create a module, it has its own structure, which we should always adhere to. A module is made up of various components such as models, views, security and so on.

An Odoo module is primarily declared by its manifest.

Each module requires a python file and a manifest file, which are named __init__.py and __manifest__.py, respectively. The module's basic structure is shown below.

odoo-creating-odoo-modules

A module is also a Python package that includes a __init__.py file with import instructions for the module's numerous Python files. For example, if the module only has one python_file.py file, the __init__.py file contains:

from . import python_file
__manifest__.py

In the manifest, we can describe the module name, author name, version, description, company, category, and so on.

Name - The module's name.

Description - A brief summary of the module.

Version - We can specify the module version here.

Licence - Enter the distribution licence here.

Author - The module's author name.

Website - The URL of the module's author's website.

Category - Specify the name of the category.

Depends - We can specify a list of modules that must be installed prior to installing the module here.

Data - These files are installed or updated as part of the module installation.

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

The module includes directories. Models, views, demos, static, security, data, wizards, and so on are all part of it.

Model

The model file consists of the __init__.py file, which imports all Python files in the model's directory.

Views

Views files are XML files that contain user interface actions and views such as forms, lists, and so on. "demo.xml" is the file format for creating an XML file.

Data

The data file contains all data files as well as the module's initial data.

Demo

It is made up of data files containing demonstration data, which can be used for testing, training, or module evaluation.

i18n

The translation files, which include.po and .pot files, are contained in the i18n file. These files do not need to be mentioned in the manifest file.

Security

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

Controllers

The Controllers folder contains code files that provide website controllers with that functionality.

Static

The static directory contains all assets that are expanded. The files in this directory are open to the public and can be accessed without a username and password. This directory contains JavaScript, style sheets, images, and other items not listed in the module manifest but referenced in the web template.

Wizard

The wizard contains all wizard-related files. In Odoo, wizards are used to store intermediate data.

Reports

Odoo assists us in producing PDF documents such as invoices and sales orders. The report directory contains all report-related files.

whatsapp_icon
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