Odoo 19 brings the newest developments in the widely used open-source ERP application. Based on a modular structure, it enables companies to handle varied operations like Sales, Purchases, Inventory, Accounting, HR, Production, and more. All functionality is presented as individual modules, providing flexibility for firms to add to existing functionality or create entirely new ones to suit their workflow requirements.
For developers, knowing the structure of these modules is the starting point for developing stable and maintainable custom applications. Let us dive deeper into the Odoo 19 module structure and how it sets the foundation for effective development.
Core Files in a Module
1. __init__.py
This is used to initialize the module. It is employed to import Python files like models, controllers, or wizards so that Odoo can load them during execution.
Example:
from . import models
from . import controllers
Without this file, Odoo won't be able to identify the directory as a Python package, and your models or controllers won't be imported.
2. __manifest__.py
The manifest file is like the module's identity card. It specifies the name, version, dependencies, assets, and other vital metadata needed for Odoo to install and execute the module.
Example:
{
'name': 'Custom Module',
'version': '19.0.1.0.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': ['static/description/icon.png'],
'license': 'AGPL-3',
'installable': True,
'application': False,
'auto_install': False,
}Key Parameters:
- name: Module name.
- version: Version number of the module.
- summary & description: Brief and detailed descriptions.
- depends: Dependencies required by this module.
- data: XML/CSV files loaded during installation.
- assets: CSS, JavaScript, and other frontend files.
- license, installable, application: Configuration flags for installation and distribution.
3. Module Components
In addition to the manifest file, Odoo modules typically consist of the following directories:
- Models/ – Contains Python classes defining business logic and database models.
- Views/ – XML files defining UI elements (form, tree, kanban, search, etc.).
- Security/ – Access rights, record rules, and group definitions (ir.model.access.csv).
- Data/ – XML/CSV files for loading default data, sequences, or configuration.
- Static/ – Static assets such as images, CSS, JavaScript, and icons.
- Wizard/ – Python and XML files for temporary or interactive forms (e.g., multi-step operations).
- Controller/ – Python controllers that handle HTTP routes and web requests.
- Report/ – XML and QWeb templates for printable reports.
- i18n/ – Translation files (e.g., en.po, fr.po) for multi-language support.
Naming Conventions and Best Practices
- Use snake_case as filenames and model names.
Example: sale_order_custom.py instead of SaleOrderCustom.py
- Prefix XML IDs with the module name to prevent conflicts.
Example: custom_module_view_form
- Group related files logically — i.e., isolate configuration data from demo data.
- Include always a security access file, even if it is empty.
- Add module icons and documentation at static/description/ to enhance clarity and presentation in the Odoo Apps list.
- Comply with Odoo's coding conventions and maintain code as PEP8-compliant for easier maintenance.
What’s New in Odoo 19 for Developers
Odoo 19 introduces various enhancements that impact developers when constructing modules:
- Improved ORM Performance: Quicker record creation and better caching for big datasets.
- Improved UI Assets: Enhanced asset bundling and ES6 JavaScript module support.
- Improved Security Layer: Tighter record rules and access validations.
- Cleaner Module Loading Process: Lower overhead on installation and upgrades.
- Better IDE Support: Improved type hints and linting for Python 3.11+.
These improvements make module development faster, safer, and more developer-friendly.
Conclusion
To develop effective, scalable, and well-integrated applications, it is critical to comprehend the structure of the Odoo 19 module. Every element—ranging from the __init__.py and __manifest__.py modules to models, views, and security rules—plays an important part in making the module run effectively in the Odoo environment.
By following best practices in file organization, dependency management, and coding standards, developers can build modules that are easy to maintain, customize, and upgrade. Whether you’re creating a new feature or enhancing an existing one, mastering the module structure lays the foundation for successful Odoo development projects.
To read more about An Overview of the Module Structure in Odoo 18, refer to our blog An Overview of the Module Structure in Odoo 18.