Odoo includes multiple business solutions like “Sales,” “Purchase,” “POS,” “Accounting,” “Manufacturing,” “Project,” “Inventory,” etc. Creating a new module means adding new logic to the business or upgrading the existing one.
This blog will help you to do a new module in Odoo 16.
Here is the structure diagram for the Odoo module.
__init__.py: This file is used as a module initializer. Usually, help for import packages/files needed for Odoo.
from . import product_package
From . import inherit_stock_rule
__manifest__.py: Here, we can define the module name and other metadata. It contains various additional information about the module like version, category, author, depended on modules, etc
{
'name': 'Product Package',
'version': '16.0.1.0.0',
'summary': """This app is managing product as the bundle""",
'description': """This app is managing the product as the bundle""",
'category': 'product',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'depends': ['base', 'sale_management', 'sale_stock', 'purchase', 'purchase_stock'],
'website': 'https://www.cybrosys.com',
'data': [
'security/ir.model.access.csv',
'views/product_package.xml',
'views/inherit_sale_menu.xml',
],
'images': [],
'license': 'OPL-1',
'price': 9.99,
'currency': 'EUR',
'installable': True,
'auto_install': False,
'application': False,
}
name: Name of the module
version: module version
summary: Summary of this module
description: The brief explanation of the module
author: The creator of this module
website: The website URL for the module
depends: These modules are installed before our module install.
Data: This contains the data file that was installed or upgraded with the module. It is a list of paths of the module directory.
image: It contains the path of the image for our module. The file is located in
Application: Here, we define whether the module is an app or not
installable: The user must specify whether this module is installed from the Web UI or not
Models: This folder consists of all python files for the module
Eg: sale_order.py
Views: This folder contains XML files of that module. Used for user interfaces like kanban, list, form, tree, menu, etc.
Eg: sale_order.xml
Static: This directory consists of all the assets. These files are public and accessed without any username and passkey. This consists of JavaScript, CSS files, Images, and others. These details are not displayed in the module manifest but give under the web template.
The JavaScript, CSS, Images, XML, etc, are given to the directory src.
Wizard: It consists of all files related to the wizard
Data: It contains all data files along with the module’s initial data.
Demo: It contains demo data, which is used for testing, training, or evaluation.
i18n: This file contains .po and .pot files. Used for the translations.
Security: It consists of the XML files that are used for the access right, group, and record rules. We can define the access right in a file
Eg: ir.model.access.csv
Controllers: contains the file that gives functionality to website controllers.