Odoo / Coding / New Module
New Module
-
Step 1:
1. Create custom module
1. Enable developer mode
2. add custom-addons path in odoo.conf
addons_path = e:\odoo\16\server\odoo\addons, e:\odoo\16\server\addons 3. new module
windowsNavigate to python.exe
Linux//navigate cd E:\odoo\python\python.exe //create new module E:\odoo\server\odoo-bin scaffold school E:\odoo\server\addons //restart service go to searchbar -> type services -> restart odoo server Navigate to location of odoo-bin
./odoo-bin scaffold school ../addons/ //restart server sudo systemctl restart odoo14 2. Structure
controllers - __init__.py - controllers.py demo - demo.xml models - __init__.py - models.py security - ir.model.access.csv views - templates.xml - views.xml __init__.py __manifest__.py 1 . all model should be added in models/__init__.py
2. all xml should be added in __manifest__.py
3. enable ir.model.access.csv in __manifest__.py 4. uncomment the code in models/models.py, security/ir.model.access.csv, view/views.xml -
Step 2: Settings
1. Enable Application Mode
open E:\odoo\16\server\addons\school\__manifest__.py
add 'application': True,
2. Module icon image
1.copy the image to E:\odoo\16\server\addons\school\static\description\icon.png
-
Step3 : Menu and view
menu
Action window
Agent Master csms.agent tree,form Country Master csms.country tree,form