Building a new module in Odoo
Odoo is an open-source ERP created by Fabien Pinckaers in 2005 and its stands for “On Demand Open Object”. Odoo is a comprehensive suite of business applications including Sales, CRM (Customer Relationship Manager), Project management, Warehouse management, Manufacturing, Financial management, Human Resources etc.
Odoo is available in the cloud or on-site and is most suited for small to mid-sized companies. It has a dynamic community and can be adapted to your business needs.
Features of Odoo Introduction:
Odoo is specially invented for small and medium sized organizations with over 1000 modules to meet all business needs. Odoo is actively being developed and supported by the community and the stack of functionality continues to increase.
Odoo is highly modular. This modular nature further helps you to integrate with the standard Apps for Full- fledged solution.
Odoo is available in different versions such as Community Version, Enterprise Version, SAAS based model to meet the business needs.
Odoo is customizable and it is highly flexible. Basically, Odoo provides a full functional package to meet business requirements, but the clients always require extra features. Odoo customization improves user interface and hence user experience.
Where to create a new module in Odoo?
Basically, all the core modules are present inside the Odoo addons folder. You can find addons path inside the Odoo configuration file and you can specify custom addons path next to addons path.
How to create a new module in Odoo?
You can place your custom module inside the addons or custom addons and configure the addons path, custom addons path in the configuration file .
Creating new module is possible in two ways,
Follow these steps to create new module on Odoo, Create new directory inside your custom addons directory in Odoo files:
1. Create __init__.py file: This file is an initializer of the module. It contains importstatements linking to folders and files in the module.
Ex: – import models, import wizard etc.
2. Create __manifest__.py file: The manifest file contains various information about thatmodule i.e. Title, Description, Summary, Depends, version etc. By seeing this file, you can get some information regarding that module.
3.Create models folder: This folder contains all your python (.py) files. All the pythonmodels that you create or inherit goes into this directory.
Ex: model.py, home.py etc.
4.Create views folder: This folder contains all your view (.xml) files. It contains form, tree,Kanban, search views, action etc.
5.Create static folder: This folder is used to store website related data. It contains twosubfolders,
7. js –contains .js files
8. img –contains images
9.css –contains .css files for designing
10. description: It contains .png files which are set as the logo of the module.
11. Create data folder: Contains data files (.xml files). You can specify the default data inthis folder.
Ex: Country, States, Unit of Measures.
12. Create security folder: This folder is used to give user roles and permissions. It containsir.model.access.csv file that gives model level security, those are read, write, create and delete permission. It contains the groups/record rules in an xml file.
13.Create controller folder: This folder contains python (.py) files. Basically, controller getsa request from the client and inquires the server. The server gets data and returns to the client.
- Scaffolding is an automatic process.
- As it is an automatic process, no need to spend lot of time for creating all required folders for module.
- With Scaffolding, you can automatically create a skeleton structure for new modules in Odoo.
- Scaffold command prefers current working directory to create new module and you can specify any directory to create a module.
command: python odoo-bin scaffold module_name folder_name
Start the server:
Command: python odoo-bin -r odoo -w odoo –addons-path=addons -d odoo14
You can now open your browser and go to http://localhost:8069. You can see this login
page if all goes well,
- Once logged into Odoo, you can see the Dashboard.
- Then activate developer mode at your Odoo from “settings”. It grants the access to technical features.
- Then go to “Apps” menu.
- Inside the “Apps” menu you will see a button “Update App List“.
- Click on “Update” button.
- Then check the module in search bar using the module name.
- Then you will find your module inside the app list.
- Then click on the “Install” button to install your module at Odoo end and you can use it.