| AMMAN-JORDAN

How to Create new module in odoo 13

By

How to create new module in odoo 13

how to create new module in odoo
how to create new module in odoo 13
By

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 :

  1. Create __init__.py file inside your new module → which is required to make Python treat the directories as containing packages.
  1. 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.

  1. Create models folder: - this folder have your python files code which has fields, classes, functions …
  1. 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.

  1. 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.

  1. views folder :- this folder used to add xml files which has views types, menus, fields, search filter…
  1. data folder:- this folder is used to import demo data when installing your module. (as .xml files)
  1. report folder: folder which containing the reports of the module.
  2. controllers folder: is a class that can be used when a user wants to render some data into a website
  3. 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

how to create new module on odoo

Here is an example code for creating new module on odoo :-

__init__.py

from . import models # to import the folder that has inside it python files.

__manifest__.py

create manifest file for odoo module

views/census_menu.xml

Menu Ex:

how to create menu on new odoo module

Now let’s check the census_view.xml file which have the views : tree form …

views/census_view.xml

tree View Ex:
how to create tree view on odoo module

Form View Ex :

how to create form view on odoo module

Search Filter Ex:
how to create search view on odoo module

security Privileges Ex:

security privilege in odoo

ir.model.access.csv file for privileges inside security folder :-

  • id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink 
    census_entry_model_access_right_user,census_entry_model_access_right,model_census_entry,base.group_user,1,1,1,1
    

ir.model.access.csv security file in odoo 13

  • 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.

TOPICS:  Odoo