Home Blog Odoo Manifest File Decoded
Odoo Manifest File Decoded

Odoo Manifest File Decoded

Odoo modules or apps are one of the most important aspects of an Odoo server. These modules consist of various Python, JS, and XML files that combine together to form an app or a module in Odoo.

One such useful and one of the most important files in an Odoo module is the Manifest File.

A Manifest file is a python file that basically contains all the descriptions of a module inside a single dictionary.

Manifest file is placed directly inside the main module folder of the Odoo App. The manifest file structure is well defined and strict norms need to be followed while creating a manifest file.


 Subscribe our Newsletter for Odoo tips, technical insights, and more!


In this blog, we are going to discuss how a manifest file is created, what its structure is, and step by step we’ll go through the elements of a manifest/descriptor file.

Manifest, as the name suggests, shows the quality of something. So, in this case, the manifest file depicts the qualities and contents of our Odoo module.

Prior to Odoo version 10, __manifest__.py file was named as __openerp__.py. The two constructors (‘_’) before and after make sure that the file is called automatically when the module is called inside the server.

Since Odoo 10, the __openerp__.py file is named as __manifest__.py file but there was no such change in the structure of the files in both the versions.

Here is a sample __manifest__.py file of a custom Odoo module.

# -*- coding: utf-8 -*-
# Copyright (C) Kanak Infosystems LLP.

{
    'name': 'Multiple Appointment Calendar',
    'version': '1.0',
    'summary': 'Multiple Appointment Calendar',
    'description': """
Multiple Appointment Calendar
================================
    """,
    'author': 'Kanak Infosystems LLP.',
    'website': 'http://www.kanakinfosystems.com',
    'images': ['static/description/icon.png'],
    'category': 'website',
    'depends': ['website', 'mail', 'calendar', 'contacts', 'sale', 'website_sale', 'hr'],
    'external_dependencies': {'python': ['sodapy', 'num2words', 'pyproj']},
    'css': ['static/src/css/style.css'],
    'data': [
        'data/appointment_data.xml',
        'data/appointment_cron.xml',
        'security/ir.model.access.csv',
        'views/appointment.xml',
        'views/res_company_view.xml'
    ],
    'demo': [],
    'qweb': [],
    'license': "OPL-1",
    'installable': True,
    'application': True,
    'auto_install': False,
    'price': ##,
    'currency': 'EUR',
    'live_test_url': ' ',
    'pre_init_hook': 'function_name',
    'post_init_hook': 'function_name',    
    'uninstall_hook': 'function_name',
}
Let us understand all the components of this file one by one...

'name': 'Multiple Appointment Calendar',
A module is called by two names one is its technical name which is the main folder name where all the module related folders & subfolders are stored and the second one is the display name which is given inside the manifest file and gives a small idea about the module. Changing the name here in the manifest file does not affect any other component of the module technically.

'version': '1.0',
Write here the module version for knowing better, which module is the updated or newest module.

'summary': 'Multiple Appointment Calendar',
A brief statement about the module, Which helps to introduce the module to its user.

  'description': """
Multiple Appointment Calendar
================================
    """,
In Description, You should write about what the module does, its key features and all the details about the module, so that user can easily understand about Model Funtionality. 
                    'description': 'Description of the module'

'author': 'Kanak Infosystems LLP.',
In this Section, you have to write the author/company name of the module, which means who created this module.

'website': 'http://www.kanakinfosystems.com',
This is the optional section, if you want to show our author/company website URL in module, write here the website URL.

'images': ['static/description/icon.png'],
Here you can set an image path that will be set up as the banner of your module, you have to set a specific path for that and the path should be ‘static/wherever the icon is stored’.

'category': 'website',
Categories could be anything. For example, if the module is account-related, then you can write the category Accounting Or if it is a sales-related Module, then you can write the category Sales etc.

'depends': ['website', 'mail', 'calendar', 'contacts', 'sale', 'website_sale', 'hr']
This section is very important in odoo manifest files when we create a module, sometimes we use some relational field or inherit model from a different module, etc. So in "depends" we add those module names in which these relational fields or models, etc are created.
 
When a module is installed, all of its dependencies are installed before it. Likewise, dependencies are loaded before a module is loaded.

'external_dependencies': {'python': ['sodapy', 'num2words', 'pyproj']},
This is the external dependencies section. It contains all the python or binary dependencies.

For python dependencies, python key must be defined in the dictionary and the dependencies module to be imported.


For binary dependencies, the bin key must be defined in the dictionary and the dependencies module to be imported.

'css': ['static/src/css/style.css'],
Here specify the custom CSS files to be imported and set a specific  path(ststic/src/css) of this file.

'data': [
        'data/appointment_data.xml',
        'data/appointment_cron.xml',
        'security/ir.model.access.csv',
        'views/appointment.xml',
        'views/res_company_view.xml'
    ],
It is a list of paths to all the data files including XML and CSV files that needed to be loaded when installing the module. The List contains a relative path for the data files from the module as the root directory.

'demo': [],
This is a list of data files that are only loaded when demonstration mode is activated during module installation.

'qweb': [],
This is for loading all your qweb templates. Generally, the javascript template file is recorded here, For importing all the qweb templates in a folder you can use the path to store the javascript XML file.(path: static/src/XML). In XML folder you can store your javascript file.

'license': "OPL-1",
Here we write the Odoo license. A License is required in all Odoo modules for security purpose, which allow to make private module and it’s very important.

'installable': True,
This section is used to define whether a module is installable in a server from web UI or not. By default, the value is ‘False’.

'application': True,
By default this section is False. If it is true, this represents whether the module is independent of other modules and provides new business logic to the system and is considered as an application other than providing some extra functionality to the existing logic.

'auto_install': False,
By default, this will be False. If it is true, the module will be automatically installed if all its dependencies are installed.

'price': ##,
If you want to sell your module at a particular price, you can define the price for the module here. If this is left blank, then the module is considered as free.

'currency': 'EUR',
After you justify the price you have to justify its currency at which it is sold.

'live_test_url': '',
You can specify the test URL of your server to test the Module.

'pre_init_hook': 'function_name',
'post_init_hook': 'function_name',    
'uninstall_hook': 'function_name',

These are the optional parameters, which take the function name as an argument.

'pre_init_hook': 'function_name', :- This parameter is executed before module installation and it takes cursor as an argument.

'post_init_hook': 'function_name', :- This parameter is executed after module installation, it takes a cursor and  a registry as an argument.

'uninstall_hook': 'function_name', :- This parameter is executed at the time of module uninstallation, it also takes a cursor and a registry as an argument.

Finally, your Manifest file look something like this after all the parameters are added to it:-

Also, you can read our other blog:- How to Create a Custom Module in Odoo

Hope this blog is helpful to you. If you are facing a problem while creating a Manifest File in Odoo, let us know in the comment section.

Get In Touch with Us

Leave a Comment

Your email address will not be published.

Submit
Your comment is under review by our moderation team.