In this blog-post you will learn about the __init__.py and __openerp__.py file of an odooÂ module.
- __init__.py â€“ This file is the initializer of the module. You might have heard about the term â€˜constructorâ€™ in java and this file acts in the same way. It contains import statements linking to folders and files in the module.
For e.g. â€“ import models, import wizard etc.
- __openerp__.py â€“ This is the manifest file of the module. It contains various information about your module i.e. Title, Description, Summary etc. You can put some light on the person installing it as why you are building this module, what is the purpose of this module and what your module really does.
The content of __openerp__.py is basically a dictionary. You need to understand the content of this dictionary.
Content of __openerp__.py file :-
- Name – The name of your module.
- Summary â€“ A brief/short introduction about your module.
- Version â€“ the version of your module. For e.g. 1.0
- Author â€“ Name of author
- Description â€“ An inâ€“length description of your module. This is most important part to mention. This part can be multiline. You can educate a user about what your module actually does. You can specify module functionality here.
- Depends â€“ the list of modules your customized module depends on. Suppose you are inheriting an existing module and adding/altering its functionality then specify the list of all the module your module depend upon.
- Contributors â€“ Odoo is developed by a community. So the name of all the people who have worked on this module appears here.
- Website â€“ Your website
- Category â€“ The section in which your module belongs. If you observe all the base modules belongÂ to aÂ certain category. For e.g. â€“ Sales, Accounting
- Sequence – When your module is listed the sequence decides the position of your module among other modules.
- Data -Â It is a list whereÂ you will specify all your view files. It can contain the following things,
- The view files (.xml file)
- The data files (.xml)
- The security file (.xml)
- TheÂ CSV files.
- Demo – Here you will specify all your demo data files.
- qwebÂ – Specify all your templates for the web interface here.
- Installable â€“ It is a Boolean value True/False.
- Auto-install – It is deprecated in Odoo v9.
- Price â€“ Odoo is open source ERP system. Since Odoo 8 you can upload your custom modules in Odoo Apps, where it can have a price. Nowadays you can see various Odoo themes sold on Odoo store.
- Currency â€“ EUR
- Maintainer â€“ OCA maintains code quality and structure when you publish your module
- License – e.g. AGPL-3
Here is a screenshot of a demo __openerp__.py file,
Hope you learnt about the __init__.py and __openerp__.py file of Odoo module, your reviews/comments/suggestions are most welcomed, please comment in the section below, and subscribe to the newsletter to receive timely future updates of this blog.
To learn about the Module Structure of Odoo, Click Here.