Enable Dark Mode!
how-to-create-and-manage-a-new-user-menu-in-odoo-19.jpg
By: Safa KB

How to Create & Manage a New User Menu in Odoo 19

Technical Odoo 19 Odoo Enterprises Odoo Community

The user menu offers a simplified dropdown that gives quick access to essential actions such as profile settings, preferences, support options, dark mode, and onboarding tools—all from one centralized place.

How to Create & Manage a New User Menu in Odoo 19-cybrosys

In this blog, we’ll demonstrate how to add a new entry in the user menu that enables developer mode. This can be achieved by extending the user_menuitems registry.

Registries in Odoo 19 act as structured collections of key–value definitions and are the primary mechanism for extending the web client. Whenever the JavaScript framework needs to load components such as fields, views, actions, or services, it retrieves them directly from the registry.

Types of Registries in Odoo 19

  1. Effect Registry – Stores the different visual and behavioral effects that can be triggered in the interface.
  2. Formatter Registry – Provides helper functions to format values, mainly used in field rendering.
  3. Parser Registry – Defines the functions that interpret or convert values into a usable form.
  4. Main Component Registry – Keeps track of core components that are loaded into the web client.
  5. Service Registry – Holds the list of services that should be initialized and available in the system.
  6. Systray Registry – Manages the elements displayed on the right-hand side of the top navigation bar.
  7. User Menu Registry – Organizes the menu entries shown in the user dropdown at the top-right corner of the interface.

Create JS file:

/** @odoo-module **/
import { registry } from "@web/core/registry";
import { browser } from "@web/core/browser/browser";
import { _t } from "@web/core/l10n/translation";
function debugItem(env) {
  const urlParams = new
         URLSearchParams(window.location.search);
  urlParams.set('debug', '1');
  const debugURL = window.location.pathname + '?' +      
          urlParams.toString();
  return {
      id: "debug",
      type: "item",
      description: _t("Developer Mode"),
      href: debugURL,
      callback: () => {
          browser.open(debugURL, "_self");
      },
      sequence: 60,
  };
}
registry.category("user_menuitems").add("debug", debugItem)

User Menu Registry in Odoo 19

The user menu registry (user_menuitems) defines the entries that appear in the user dropdown menu (the section in the top-right corner of the navbar that shows the logged-in user’s name).

Each menu entry is represented by a function that receives the current env (environment) and returns an object with the following properties:

  • description – The label displayed for the menu option.
  • href (optional) – If provided, the item is rendered as a clickable link (<a>) pointing to this URL.
  • callback – The action that should run when the menu item is selected.
  • hide (optional) – Determines if the item should be hidden. Defaults to false.
  • sequence (optional) – Controls the position of the item relative to others in the dropdown. Defaults to 100.

Whenever the user opens the menu, Odoo evaluates all registered functions to dynamically generate the list of menu items.

Add in manifest

'assets': {
   'web.assets_backend': [        
      'sale_discount_limit/static/src/js/user_menu.js',
   ]
}

After installing the module, a new entry called “Developer Mode” will be added to the user dropdown menu in the top-right corner of the navigation bar. Selecting this option will activate debug mode for the current session.

How to Create & Manage a New User Menu in Odoo 19-cybrosys

In Odoo 19, the user menu provides quick access to key user-related actions directly from the top-right corner of the interface, helping users navigate faster and manage their preferences more efficiently.

To read more about How to Create & Manage a New User Menu in Odoo 18, refer to our blog How to Create & Manage a New User Menu in Odoo 18.


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