Enable Dark Mode!
registries-in-odoo-16.jpg
By: Sonu S

Registries in Odoo 16

Technical Odoo 16

Registries are sorted by value or keymap. This is the main extension of the web-client point.  Plenty of functions regulated by the Javascript framework in Odoo simply refer to the registry when objects (views, fields, actions, clients, etc.) need to be defined. Customizing the web client is as simple as adding specific values to the appropriate registry.
The example for importing the registries is as follows:
import { registry } from "@web/core/registry";
const registry = new Registry();
registry.add("test1", false);
registry.add("test2", "");
registry.add("test3", 0);
A useful function of the registry is to store acquired sets of sub-registers in the form of categories. If the sub-registry does not already exist, it will be created on startup. Thus, all the registries used by the web client are extracted from the original registry and exported to @web/core/registry.
The example of different registries as follows:
import { registry } from "@web/core/registry";
const fieldRegistry = registry.category("fields");
const viewRegistry = registry.category("views");
const serviceRegistry = registry.category("services");
Category of registries
1. Effect registry
The Effects registry contains a frame of all available effects. You can add new effects by assigning them names and functions. The example for rainbowman effect is as follows:
const effectRegistry = registry.category("effects");
effectRegistry.add("rainbow_man", rainbowMan);
2. Formatter registry
The formatter registry contains functions to format values. Each format has the following APIs:
format (value [, options])
3. Main components registry
The main components registry uses to add higher-level components to the web client. This component is essentially a direct representation of an ordered list of elements registered in the main component register. For example, you can add BlockUI components to the registry as follows:
registry.category("main_components").add("BlockUI", BlockUiFromRegistry);	
4. Parser registry
The parser register contains functions for parsing values. Each parser consists of a value it is a string, Optional (object) - Various options (parser specific):
parse(value[, options])
5. Service registry
The Service Registry consists of complete services that need to be activated in the framework.
registry.category("services").add("myService", myService);
6. Systray registry
Systray is the area to the right of the navigation bar. This typically includes information (e.g., the number of unread messages), notifications, and various additional elements the user can interact with.
7. User menu registry
The user menu registry (user_menuitems) contains all the menu items that appear when the user menu is opened (navigation bar items have the username in the upper right corner).
The effects registry contains the structure of all available effects. You can add a new effect by giving it a name and function. An example of the Rainbow Man effect is:
const effectRegistry = registry.category("effects");
effectRegistry.add("rainbow_man", rainbowMan);
Conclusion:
The registry is the main extension point for the web client. Many features provided by the Odoo JavaScript framework require access to the registry only if some object needs to be defined.


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



0
Comments



Leave a comment



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