Understanding __init__.py and __openerp__.py file in Odoo

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 :-

  1. Name – The name of your module.
  2. Summary – A brief/short introduction about your module.
  3. Version – the version of your module. For e.g. 1.0
  4. Author – Name of author
  5. 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.
  6. 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.
  7. Contributors – Odoo is developed by a community. So the name of all the people who have worked on this module appears here.
  8. Website – Your website
  9. 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
  10. Sequence – When your module is listed the sequence decides the position of your module among other modules.
  11. Data - It is a list where you will specify all your view files. It can contain the following things,
    1. The view files (.xml file)
    2. The data files (.xml)
    3. The security file (.xml)
    4. The CSV files.
  12. Demo – Here you will specify all your demo data files.
  13. qweb  – Specify all your templates for the web interface here.
  14. Installable – It is a Boolean value True/False.
  15. Auto-install – It is deprecated in Odoo v9.
  16. 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.
  17. Currency – EUR
  18. Maintainer – OCA maintains code quality and structure when you publish your module
  19. License – e.g. AGPL-3

Here is a screenshot of a demo __openerp__.py file,

odoo openerp file

Odoo openerp file. Click the image to enlarge.

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.

Share This!
Share On Twitter
Share On Linkdin
Contact us

Related Posts

About the Author: Burhan Vakharia

I, Burhan Vakharia, am a python developer, CS Lover living in Gandhinagar, Gujarat, India. I have a degree in Computer Science and Engineering from Babaria Institute of Technology. I am currently working as Odoo Developer at Serpent Consulting Services Pvt. Ltd., Gandhinagar. Apart form Odoo Framework, i have worked on C# .Net and Android Platforms.

Leave a comment

Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Contact us
Hide Buttons