Enable Dark Mode!
By: Renu M

How to Define Menus & Actions in Odoo 17?

Technical Odoo 17

In the realm of open-source business management solutions, Odoo stands out as a versatile and powerful platform that empowers organizations to streamline their operations. A key aspect of Odoo's user interface customization lies in the definition of menus and actions. These components play a pivotal role in shaping how users interact with various modules, contributing to a seamless and intuitive user experience.

In this comprehensive guide, we will delve into the intricacies of defining menus and actions in Odoo 17. Whether you're a seasoned Odoo developer or a business user looking to optimize your system's layout, this step-by-step tutorial will walk you through the process of creating menus, configuring actions, and linking them together. Understanding these fundamental elements is essential for tailoring Odoo to your specific business needs and ensuring a user-friendly interface that enhances productivity.

Initially, let's explore the process of generating a menu item in Odoo 17 by establishing a custom module named 'Student Management.'

<menuitem id="student_menu_root"
              name="Student Management"
        <menuitem id="student_order_menu"
            <menuitem id="menu_student_records"
                      name="Student Records"

In this snippet, we start by defining the main menu item, named "Student Management." This menu item serves as the root for organizing various features related to student management.


Within the "Student Management" menu, we create a sub-menu called "Students." This sub-menu will house specific functionalities related to students. Inside the "Students" sub-menu, we define a menu item called "Student Records." This menu item is associated with a specific action, identified as "action_student_record." Actions define what happens when a user interacts with a menu item, such as opening a form or triggering a specific operation.


In summary, this XML code structures the student management menu in a hierarchical manner. The "Student Management" menu contains a sub-menu "Students," and within it, there's a menu item "Student Records" linked to a particular action. This organization not only enhances the visual clarity of the Odoo interface but also defines the flow of user interactions when navigating through the student management features.

<menuitem id="class_menu"
              name="Class Records"

The XML code snippet introduces an alternative method for structuring menus in Odoo 17 by utilizing the "parent_id" attribute: The menu item with the identifier "class_menu" is defined, representing a feature related to class records in the school management system. The attribute "name" specifies the display name for this menu item, which is set as "Class Records."The "parent" attribute is employed to designate the parent menu item to which "class_menu" belongs. In this case, it is associated with the menu identified as "school_management.student_order_menu."Here school_management is the module name.


By utilizing the "parent" attribute, this approach establishes a hierarchical relationship between menus, simplifying the organization of features and providing a structured navigation flow within the Odoo interface. This method offers flexibility in defining menu structures and is particularly useful for extending existing menu hierarchies in a modular and intuitive manner.

As demonstrated in the earlier menu item code, which includes attributes like id, name, parent, and sequence, we can further enhance menu item functionality by introducing the "actions" attribute. This attribute plays a crucial role in specifying the action to be performed when the menu item is selected.

In this context, let's consider an example where clicking the menu item navigates to a tree view of the "student.record" model in Odoo 17.

<record id="action_student_record" model="ir.actions.act_window">
        <field name="name">Student Records</field>
        <field name="res_model">student.record</field>
        <field name="view_mode">tree,kanban,form</field>
        <field name="context">{}</field>
        <field name="domain">[]</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                Create a new Student, the first step of a School Management!

In this code snippet, an action record named "action_student_record" is created. It specifies the following:

The action, identified as "action_student_record," is created to manage the behaviour of a menu item named "Student Records."

The "name" field sets the display name for this action as "Student Records."

The "res_model" field specifies the model to which this action is associated, in this case, "student.record."

The "view_mode" field outlines the different views available for this action, including tree view, kanban view, and form view.

An empty "context" field indicates that no additional context is applied to this action.

The "domain" field, set as an empty list "[]," defines the domain filter for the records displayed, though it is not applied in this instance.

The "help" field provides a helpful tooltip message with the type set to HTML, encouraging users to create a new student as the initial step in school management.


This window action, defined in the "ir.actions.act_window" template, is instrumental in orchestrating the behavior of the menu item. By assigning the action’s ID to the "action" attribute inside the menu item, we establish a seamless connection between the menu item and the desired action.

Upon clicking the menu item, the user interface responds by opening the specified tree view, providing a streamlined and intuitive experience for users interacting with the system.

By understanding the intricacies of menu item creation and action configuration, users and developers can wield a powerful toolset in crafting a user-friendly environment within Odoo. The flexibility offered by attributes such as "parent," "sequence," and "actions" empowers customization at various levels, ensuring a structured and intuitive navigation flow.

As highlighted in our examples, the synergy between menu items and actions becomes particularly apparent when linking specific models and views. Whether it's directing users to a tree view of real estate properties or facilitating the management of student records, the strategic use of actions amplifies the efficiency and relevance of menu items.

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


Leave a comment




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



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



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

Send Us A Message