The Anatomy of an Odoo Module

A module is the unit of everything in Odoo. What a module is made of.

In Odoo, the module is everything: every application and every customization is a module. Understanding what a module is made of is the foundation of Odoo development. This piece is the anatomy of an Odoo module.

The module as the unit

An Odoo module is a self-contained package of functionality, a directory of files that Odoo loads. Everything in Odoo is a module, so a module is the unit in which Odoo functionality is packaged. To understand Odoo development is, in large part, to understand the anatomy of a module: what it is made of, and how the parts fit.

The manifest

Every module has a manifest, the file that describes the module: its name, what it depends on, and which of its files Odoo should load. The manifest is how Odoo knows the module exists and what it consists of. The manifest is so central that writing it correctly is a matter in its own right; here, the point is that the manifest is the part of a module that declares it and ties its files together.

The models

The models, written in Python, define the module's data and business logic: the kinds of record the module introduces or extends, and the logic that operates on them. The models are the back-end substance of a module, where the data the module deals with is defined and the logic lives.

The views

The views, written in XML, define the user interface: how the module's data is presented and interacted with, the forms, the lists, the other views, and the menus by which users reach the records. The views are how the module's data is genuinely seen and worked with.

The security

The security part of a module declares who can access its data: the access rights, and where needed the record rules, that govern what users can do with the module's records. Security is part of a module's anatomy, not optional housekeeping; a module's data is genuinely usable and genuinely controlled only if the security is there.

Data, assets, and controllers

A module may also include other parts. It may include data files, data the module should load. It may include static assets, images, styling, and front-end code. It may include controllers, the web-facing code, where the module has web-facing functionality. These are the further parts a module may have, alongside the models, views, and security.

How the parts fit together

The parts of a module form a coherent whole. The manifest ties it together and tells Odoo what to load. The models define the data and logic. The views present the data to users. The security governs access. The further parts add what they add. A module is sound when these parts are each genuinely right and they fit together coherently, the views matching the models, the security covering the data, the manifest correctly declaring it all. Understanding the anatomy of a module is understanding these parts and how they fit, which is the foundation of building modules well.

The takeaway

The anatomy of an Odoo module: a module is a self-contained package of functionality, the unit of everything in Odoo, made of a manifest, which describes it and ties it together; models, which define its data and logic; views, which present its data; security, which governs access; and, as needed, data files, static assets, and controllers. A module is sound when these parts are each right and fit together coherently. Understanding the anatomy of a module is the foundation of Odoo development. For how we approach Odoo, see our ERP practice.

All posts

Got a Topic Worth Posting?

Suggest a Topic

If a question keeps coming up in your operations, it might be worth its own post.