How to Create new module in odoo 13
How to create new module in odoo 13
How to Create new module at odoo 13:
Odoo is an opensource business management software (ERP), you can build new module on odoo throw these :
Follow these steps to create new module on odoo, Create new directory inside your addons directory in Odoo files :
- Create __init__.py file inside your new module → which is required to make Python treat the directories as containing packages.
- Create __manifest__.py inside your new module→ which is to declare a python package as an Odoo module and to specify module metadata,
__manifest__.py : is the file that have your module information, xml files related to module which have your views menus … and on what module it depends.
- Create models folder: - this folder have your python files code which has fields, classes, functions …
- Create security folder: - this folder have your module privilege: read, create, delete, modify for your module data and user access.
Inside a file called (ir.model.access.csv) required name, which has privileges access.
- static folder which are typically files such as scripts, css, js, images …
You can add icon (image) for your module inside static folder, following this structure directories:
static folder→ description folder→ your-image. To put image for your new module.
- views folder :- this folder used to add xml files which has views types, menus, fields, search filter…
- data folder:- this folder is used to import demo data when installing your module. (as .xml files)
- report folder: folder which containing the reports of the module.
- controllers folder: is a class that can be used when a user wants to render some data into a website
- I18n folder: The I18n contains the translation of module in different languages.
This folders structure is the best way to handle, modifying, creating any new or exist module in odoo 13, so stay tuned to it
Here is an example code for creating new module on odoo :-
from . import models # to import the folder that has inside it python files.
Now let’s check the census_view.xml file which have the views : tree form …
tree View Ex:
Form View Ex :
Search Filter Ex:
security Privileges Ex:
ir.model.access.csv file for privileges inside security folder :-
- This four numbers is for : create, read, write, unlike(delete) which value can be 0 or 1.
Install this training module from Github
Finally you can install the training example module from Github, to continue learning on developing modules from this link (github).
when you install it take T_census directory only without T_census-master and put it in your addons directory.
© 2020 PyOdoo.