Greetings Everyone,
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.
Thank You.