Enable Dark Mode!
an-overview-of-the-module-structure-in-odoo-18.jpg
By: Aysha Shalin

An Overview of the Module Structure in Odoo 18

Technical

Odoo is an efficient and powerful ERP software that comprises various applications and modules that help to run various business operations smoothly across industries. It offers solutions for CRM, ERP, accounting, inventory, HR, e-commerce, and more, all within a modular and user-friendly platform. Known for its flexibility and scalability, Odoo caters to businesses of all sizes, enabling them to customize and automate workflows to boost efficiency. With a strong global community and continuous improvements, Odoo stands out as a cost-effective alternative to traditional enterprise solutions.

Modules are the essential building blocks of Odoo, so it’s important to follow certain guidelines when creating new ones. This blog provides an overview of the module structure in Odoo 18. 

__init__.py

It is used to import Python files (such as models, controllers, or wizards) within the module.  Without this file, Python would not recognize the directory as part of the module.

from . import models
from . import controllers

__manifest__.py

This file defines the module’s metadata, such as its name, version, category, summary, etc. It serves as a configuration file that helps Odoo identify and load the module properly.

Here is an example of how a manifest file looks.

{
    'name': 'Module Name',
    'version': '1.0',
    'summary': """Summary of the Module""",
    'description': """Description of the Module""",
    'category': 'product',
    'author': 'Cybrosys Techno Solutions',
    'company': 'Cybrosys Techno Solutions',
    'maintainer': 'Cybrosys Techno Solutions',
    'website': 'https://www.cybrosys.com',
    'depends': ['base'],
    'data': [
        'security/ir.model.access.csv',
        'data/filename.xml',
        'views/filename.xml',
    ],
    'assets': {
       'web.assets_backend': [
           'module_name/static/src/js/*.js',
           'module_name/static/src/css/*.css',
           'module_name/static/src/img/*',
       ],
   },
    'images': [],
    'license': 'AGPL-3',
    'installable': True,
    'auto_install': False,
    'application': False,
}

Let’s break down these parameters,

name: This is the name of the module.  

version: This specifies the version of the module. 

summary: A concise one-line summary describing the module's purpose and functionality.

description: More detailed module description.

category: The category in which the module is classified.

author: Name of the author of the module.

company: Name of the company

maintainer: Name of the person or team responsible for maintenance of the module.

website:  URL of the module's or the maintainer's website.

depends: List of the modules this module depends on.

data: List of the XML or CSV files that should be loaded when the module is installed or updated. These files typically include views, security files, data records, and other configuration files required for the module.

assets: Assets define the CSS, JavaScript, and other assets (such as images and fonts) to be included in the module. 

images: This parameter lists the image paths associated with the module.

license: Specifies the license under which the module is distributed.  

installable: This parameter is a boolean that specifies whether the module is installable in Odoo. 

application: This parameter is a boolean that defines whether the module is a standalone application. 

auto_install: If this is set to True, the module will be installed automatically when dependencies are satisfied.

Module Components

In addition to the manifest file, Odoo modules have several other components that help define their structure and functionality. Here are the key components of an Odoo module:

Models

Contains Python classes that define the business logic and data models of the module. 

Views

Contains XML files that define the user interface elements for the module.

Security

Defines access control rules for the module, such as user permissions, record rules, and groups. 

eg: ir.model.access.csv

Data

Contains XML, CSV, or other data files for initialization or demonstration purposes.

Static

Includes all static assets such as images, JavaScript, CSS, and other media files used by the module.

Wizard

Contains Python and XML files for creating wizard forms, which are typically used for custom interactions or batch processing.

Controller

Defines HTTP controllers for handling web requests.

Reports

Defines the files needed to create custom reports.

i18n

Contains translation files for making the module available in multiple languages. Ex: en.po, fr.pot.

Conclusion

In conclusion, understanding the module structure in Odoo is essential for creating, customizing, and maintaining efficient applications within the platform. 

By following the best practices in organizing these components, developers can build scalable, maintainable, and robust Odoo modules that integrate well with the overall system. Whether you're developing a new module or customizing an existing one, a clear understanding of the Odoo module structure will pave the way for successful implementation.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



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