Understand Odoo Module Structure

In this article, we will explain you to understand Odoo module structure and Odoo coding guidelines tips. Before you start to create Odoo module, you should know of Odoo module structure.

We must say that Odoo module has organized very logically. All directories have some unique, definite purpose of storing files. So let’s start to understand the use of all directory and files in Odoo module.

Odoo Module Structure
Odoo Module Structure

Odoo Module Directory Structure


In this file, you have to import, or register or even you can say initialize two items. First, you can specify directories which contain python files that we used in Odoo module. Second, specifies the python files which directly exist in Odoo module (except folders). But now a day you should avoid putting python file in the root path of the module.

from . import models			// folder
from . import controllers		// folder
from . import res_partner 		// file

Note: Do not import/specify __manifest__.py file in __init__.py file. Because this is leading file in Odoo module so it will directly access from Odoo framework to register module.


Every Odoo module must have an __manifest__.py file with precisely that name at the root of the module. The manifest file describe essential information about your module. For example module name, and many other optional fields you can specify.

The manifest file you can declare the following fields:

  • Name – Name of the module
  • description – Brief description of the module
  • version – Specify the version of the module
  • license –  Specify the distribution license of the module
  • author – Author name of the module
  • website – Website URL of the module author
  • category – Specify the category name. Use existing categories is recommended.
  • depends – Specifies a list of modules which install first before installing the module.
  • data – List of the data files which are always installed or updated with the module.
  • demo – List of the data files which are installed or updated in active demonstration mode.


Models directory contains all your python (.py) files. These python files contain models that you create or inherit existing models and main business logic. For example, we create one res_users.py file in the module. So my model folder contains 2 following files.


from . import res_users


# -*- coding: utf-8 -*-

import json

from odoo import models, fields, api

class ResUsers(models.Model):
    _inherit = 'res.users'


Note: All python (.py) files in any directories, we must have to import/register into __init__.py file in that respected directory.


This directory contains all your .xml files where you store you kanban view, form view, menu, action, Qweb template, and many others.


This directory holds .py files. The controller is a class that is derived from the base class. All requests are handled from the browsers and pass to server. It’s like a middle bridge to communicate between models and views.

Note: All python (.py) files in any directories, we must have to import/register into __init__.py file in that respected directory.


This directory contains description and src two subdirectories.

description: This directory contains one icon.png file that represents the module icon in App list. And another, index.html file holds documentation of the module. It will give information about module functionality along with a screenshot.

src: This folder contains many sub-directories.

  • img – this folder store images which are we used in a module
  • css – store one or more CSS file for applying styles
  • scss – store one or more SCSS file for applying styles
  • js – It contains one or more JavaScript files
  • xml – Finally, this folder contains XML file that holds preserved QWeb code. Using JS, it will render.


This directory content .xml files hold some predefined data. For example, counties, states name data. Data files always load at the time of the module install.


Same as above this directory content .xml files hold demo data. However, it will enable only when you checked demo data while creating a database. Demo files always load at the time of module install.


This folder contains two files. Access control file and Record rules file.

Access Control: Specifies the access rights of models. Hence, you need to create an ir.model.access.csv file that holds access rights of the models.
Record Rules: Basically, record rules are conditions. That must have to satisfy to perform such operations like create, update to allowed. It is applied record-by-record after applying access control. Consequently, you need to create a security.xml file that holds record rules.


As the name suggests, this folder contains all the report files. It’s store two type files. First, python (.py) files for parsing and second, qweb (.xml) files for formatting report design in Odoo.


Basically, it will create a modal window. This folder contains python and xml file. Python file contains a model that extends the TransientModel. Moreover, this model is a temporary model which will automatically be deleted after execution completed. Furthermore, the XML file contains view files of the modal.


Testing files will store in this folder. All test cases are write-in .py and .yml files.


In this directory holds .po and .pot files. These files store the translation of the module. One .pot file that store module strings, which we want to translate. Whereas .po file stores all content of .pot file along with translated string.


This directory contains documentation (.doc format file) of the module. It gives information about module functionality.

Odoo Guidelines (Tips)


Imports are ordering as per below.

  1. External python libraries
  2. Import Odoo directory files (framework files)
  3. Import from Odoo modules (use for extending functionality any existing modules)


Install the pep8 package in your IDE that will you to show syntax and semantic warnings or errors.

Idiomatics Python File

Every python file you have to declare # -*- coding: utf-8 -*- in the first line. Howevert, this declaration is not needed in Python 3 as UTF-8 is the default source encoding.

We hope you have found this article helpful. Let us know your questions or feedback if any through the comment section in below. You can subscribe our newsletter and get notified when we publish new articles. Moreover, you can explore here other Odoo related articles.

If you like our article, please consider buying a coffee for us.
Thanks for your support!

Support us on Buy me a coffee! Buy me a coffee!

Join the Discussion.