Hello Odooers , Odoo gig and Odoo Lovers,
Before creating any odoo module you should have first knowledge of odoo module structure.
SO, In this Odoo technical tutorial I would like to explain about Odoo module structure in depth.
- __init__.py :-
it’s initialisation python file of odoo module where all other python file are imported. Means, you can import all the python files directory which used in odoo module. Let’s say in module you have 2 model files named with test.py and hello.py
As ex: from . import module,
from . import wizard
2. __manifest__.py :–
A manifest file of the module. It contains all information about module like module name, version, category, description, summary, associated views, demo , data files. it also contain the who written the module author name and it’s website details inside.
3. models :–
Directory contains all your python (.py) files. All the python models that you create or inherit goes into this directory. For e.g. –test.py, hello.py
Note:- All the .py files which is in models folder we must import into __init__.py file
from . import models
In the __init__.py file inside the model’s folder,
from . import test
from . import hello
4. views :–
Directory contains all your .xml files. where you can design odoo views like form view, tree view, search views, action, menu etc
Data files is necessary files which will load predefined data into database when installing any module/apps in odoo. for example Product module unit of measures is predefined data
demo data files only loaded when you mark “Load demonstration data” true when create database in odoo. otherwise it will not load into database. demo data is testing purpose data which may help how to record data in few application and how to test it with some bunch of pre-loaded data.
[^] Load demonstration data (Check this box to evaluate Odoo)
7. static :–
Directory having with few sub directory which contain all the website related files like js, img css,xml, font
css:– it contain all .css files which is use for designing
img:– it contain all images
js:– it contain all .js files
xml:– it contain all .xmls files used for view/qweb templates
it contain module brief introduction file called “Index.html” , where you can demonstrate about module functionality with screen shots
it’s also contain the icon.png file which you used for module icon
8. wizard :–
it’s contain model that extends the class TransientModel instead of Model and contains it’s view files.
it’s temporary model which will deleted automatically after execute.
9. Report :-
it contain all the report file. Report all .py (parser) file and .xml file for qweb to design pdf report in odoo
10. security :-
Directory contain main file to set up access rights, roles and permission, groups etc.
Access rights csv file(ir.model.access.csv) : To assign access like read, write,create, delete permission based on model, user group
security.xml : which contain to create groups, category, record rules etc.
11. controller :–
controller file which handle requests from web browsers and response to the server.
12. i18n :-
Directory contains the translation of module in different languages. Mainly contains two type of files .po and .pot. in which .po files are the actual translation files and .pot is the template for the translation.
13. Doc :-
Directory contains documentation file in .doc format which having more information about module functionality.
14. Test :-
In odoo testing file will kept into test directory. it contain different .py and .yml file having different test cases.
For any query and question ask us in below comments.
To get more odoo updates join with us our newsletters !
GET IN TOUCH.!
We’d Love to Hear from You! We are happy to answer any questions, you have regarding My Training.
Mail : firstname.lastname@example.org
Skype : mayur_maheshwari1
What’s app : +919924542042