DEV Community

Cover image for Odoo 101: Create a Module
Abraham
Abraham

Posted on

Odoo 101: Create a Module

Introduction

Hello everyone today I want to share about Odoo Development. In this tutorial I will cover about creating module, and install it on your local Odoo.

Creating a new module

1. Create module dir

In this steps we must create a dir file in the addons directory.

Requirement:

  • Lowercase only, Example: sale_order, not SaleOrder or Sale-Order.
  • Underscores for separation, Use underscores (_) to separate words instead of dashes or camelCase. Example: helpdesk_repair, product_warranty.
  • Avoid special characters Only use letters, numbers, and underscores. Avoid spaces, dashes, dots, or other symbols.
  • Unique across the Odoo instance

ps: addons directory can be seen on odoo.conf

tips: dir name is very important because it will be used when a module is being depend on.

2. Create Manifest file

In this steps we will add __manifest__.py file in the root of the module directory.

Example:

sale_dashboard
|
└── __manifest__.py
Enter fullscreen mode Exit fullscreen mode

Below is manifest example

{
    'name': <Application Name(str)>,
    'version': <Application Version(str)>,
    'summary': <Application Summary(str)>,
    'description': <Application Description(str)>,
    'author': <Author(str)>,
    'depends': <Dependency(list(str))>,
    'category': <Application Category(str)>,
    'data': <Data File(list(str))>, 
    'assets': <Static asset(dict(str))>,
    'license': <Application License(str)>,
    'application': <Is this application or technical app(Bool)>,
}
Enter fullscreen mode Exit fullscreen mode
  • depends: Specify dependency modules of the current module. When the module is installed, the depend module will automatically installed.
  • license: Specify license for the module. Supported license: AGPL-3, GPL-3, LGPL-3, OPL-1, Other OSI approved licence, Other proprietary, OEEL-1. More information here.

3. Install module into Odoo

Firstly, we must open the Odoo in your web browser. In my case I use http://localhost:10017/web

Odoo App interface

Secondly, we activate the debug mode. Debug mode can be activated by adding ?debug=1 in the url. After activating debug mode, we can now see Update App List button.

Odoo interface (debug mode)

After clicking Update App List, a window will be opened and we can update the app list.

Update app list window

Updating app list could be used to insert new added app into Odoo app.

Finally, we can search the app by using the search bar.

Installing Module

When searching odoo module we can use the name from module directory or the name from manifest file.

Final Words

This is the end of tutorial, there are still a lot of things to covers for example creating a view, adding icons, creating models, wizard, depending on other module, Qweb, uploading module to Odoo store, etc. I will continue about Odoo tutorial in the next article.

Top comments (0)