Enable Dark Mode!
everything-you-need-to-know-about-registries-in-odoo-19.jpg
By: Rheshikes PK

Everything You Need to Know About Registries in Odoo 19

Technical Odoo 19 Odoo Enterprises Odoo Community

Odoo 19 introduces an even more modular, extensible, and cleaner frontend architecture powered by Owl. One of the most important pillars of this architecture is the concept of registries. Whether you’re customizing web views, extending the Point of Sale, or adding new frontend behaviors, registries help you plug features into Odoo without ever touching core code.

In this blog, we’ll break down what registries are, how they work, and why they are essential for modern Odoo development.

/** @odoo-module **/
import { registry } from "@web/core/registry";
const myService = {
   start(env) {
       return {
           sayHello(name) {
               console.log(`Hello ${name}!`);
           }
       };
   }
};
registry.category("services").add("hello_service",helloService);

Odoo stores all frontend components inside the global “registry” system, and importing registry gives your JavaScript file access to that system.

The registry is a global dictionary in Odoo 19 used to store services, views, actions, components, pos features etc.

start() runs automatically when Odoo initializes. Whatever you return from start() becomes the public API of your service. The service returns one method: sayHi(). Calling sayHi() prints: “Hi from my service!”

registry.category("services").add("hello_service",helloService); adds your service to the Odoo system.

You can access this service using:

/** @odoo-module **/
import { useService } from "@web/core/utils/hooks";
import { Component } from "@odoo/owl";
export class TestComponent extends Component {
   setup() {
       const hello = useService("hello_service");
       hello.sayHi();
   }
}

useService is a hook provided by Odoo’s OWL framework. It allows a component to access a service registered in the service registry.

You can also extend existing services:

/** @odoo-module **/
import { registry } from "@web/core/registry";
registry.category("services").add("hello_service", {
   dependencies: ["hello_service"],
   start(env, { my_service }) {
       return {
           ...hello_service,
           hi() {
               console.log("Hi from extended service");
           }
       };
   },
});

Categories of Registries in Odoo 19

Registries in Odoo are grouped into specialized categories, each designed to handle a specific type of asset, behavior, or interface element within the framework. This structure makes it easier for developers to organize features, extend existing functionality, and build modular, reusable components across the system.

Effects Registry

The Effects Registry in Odoo 19 is a frontend registry used to define reusable UI effects that components can trigger. These effects are typically small, self-contained functions responsible for enhancing the user interface—for example, animations, highlights, transitions, error flashes, or attention-drawing interactions.

const effectRegistry = registry.category("effects");
effectRegistry.add("my_custom_effect", myCustomEffect);

Formatter Registry

The Formatter Registry stores a collection of functions whose job is to convert raw values into human-friendly, display-ready strings. Every formatter follows a standard API structure, which ensures consistency across the entire Odoo frontend.

const formatterRegistry = registry.category("formatters");
formatterRegistry.add("uppercase",(value)=>value.toUpperCase());

Main components Registry

In Odoo 19, main_components is a special OWL registry category that lets you inject a UI component directly into the WebClient layout, not into a specific view or action. Components registered here are loaded once when the web client starts, remain independent of views, actions, or dialogs, and persist while you navigate between menus.

registry.category("main_components").add("GlobalNotification", {
   Component: GlobalNotification,
});

Service Registry

The service registry (category: "services") is used to define global frontend services that are automatically started by the Odoo framework when the WebClient loads. A service is not a UI component; instead, it provides reusable logic or functionality that can be accessed from anywhere in the frontend using useService().

/** @odoo-module **/
import { registry } from "@web/core/registry";
const notificationService = {
   showMessage() {
       console.log("Notification service triggered");
   },
};
registry.category("services").add("notification_service", notificationService);

Systray Registry

The systray registry (category: "systray") is used to add small interactive UI components to the right side of the top navigation bar in Odoo. These items usually show status information, counters, or quick actions, such as unread messages, notifications, or alerts.

/** @odoo-module **/

import { Component } from "@odoo/owl";
import { registry } from "@web/core/registry";
class StatusSystrayItem extends Component {
   setup() {
       this.status = "Online";
   }
}
StatusSystrayItem.template = "my_module.StatusSystrayItem";
registry.category("systray").add("my_module.status_systray", {
   Component: StatusSystrayItem,
});

Usermenu Registry

The user menu registry (category: "user_menuitems") is used to add custom entries to the user dropdown menu (the menu that opens when you click the user name/avatar on the top-right navbar).

Each user menu item is defined by a function that receives the env and returns a plain object describing how the menu item should behave.

/** @odoo-module **/
import { registry } from "@web/core/registry";
registry.category("user_menuitems").add("my_module.profile", (env) => {
   return {
       description: env._t("My Profile"),callback: () => {               env.services.action.doAction("base.action_res_users_form");
       },
       sequence: 20,
   };
});

Registries in Odoo 19 are a powerful and flexible mechanism that allow developers to manage, organize, and extend frontend components, services, and behaviors in a modular way. By categorizing assets into effects, formatters, main components, services, and systray items, Odoo ensures that customizations are reusable, maintainable, and upgrade-safe.

Whether you are creating new UI components, adding custom services, or extending existing functionality, understanding and leveraging registries is essential for writing clean, scalable, and future-proof code in the Odoo 19 OWL framework. 

To read more about Registries in Odoo 18, refer to our blog Registries in Odoo 18.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



Recent Posts

whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message