Creating Actions and Menuitem Odoo 8 tutorial

Greetings Everyone,

In this blog-post tutorial, you will learn how to create an Action and its Menuitem in an Odoo 8 module.

Type of Actions in Odoo:

  • Window Actions (ir.actions.act_window)
  • URL Actions (ir.actions.act_url)
  • Server Actions (ir.actions.server)
  • Report Actions (
  • Client Actions (ir.actions.client)

Here we’ll learn about the Window Action.

What is Window Action in Odoo?

  • Window Actions are used to present visualisations of a model through views.
  • A window action defines a set of view types (and possibly specific views such as Tree, Form, Search) for a model (and possibly specific record of the model).

Example of Action and Menuitem :-

Earlier in my previous blog-posts, I created a student model, then I created its Form View followed by Tree View.  Now in this tutorial, I will create Action and Menuitem for it.

Code for creating an Action and its MenuItem:-

<!-- Action for Student Information -->
		<record id="action_student_information" model="ir.actions.act_window">
			<field name="name">Student Information</field>
			<field name="res_model">student.student</field>
			<field name="view_type">form</field>
			<field name="view_mode">tree,form</field>

		<!-- Top bar menu -->
		<menuitem id="menu_college_main" name="College"/>
		<!-- Left Sidebar MenuHead -->
		<menuitem id="menu_student_main" name="Student" parent="menu_college_main"/>
		<!-- Left Sidebar Menu -->
		<menuitem id="menu_student_info" parent="menu_student_main" action="action_student_information"/>

Steps for creating Action:-

  • Window actions are stored in database table ir_act_window. So first, write record tag and give unique id and ir.actions.act_window model. See the above code for reference.
  • Next, the string given in ‘name’ will appear on the menuitem (if the string is not provided in menuitem). Here I have given ‘Student Information’.
  • Further, very important, provide your model name in ‘res_model’. This will link your action with your model. Here I have given ‘student.student’.
  • ‘view_mode’ will give sequence to your views. Here tree and form view will be displayed first and second, respectively.
  • When is action called? The action is called when you click on its related menuitem.

SnapShot of Eclipse IDE:-

Action-in-Odoo – Click to Enlarge

Steps for creating Menuitem:-

  • Menuitems are created by <menuitem> tag
  • Provide unique id in ‘id’.
  • Provide the id of the parent menu in ‘parent’. Here i wanted to show ‘Student’ under ‘College’, so I wrote the id of ‘College’ menuitem in ‘Student’ menutiem.
  • Write the id of the action just created above inside ‘action’ attribute. Here, ‘action_student_information’.

SnapShot of created Menuitem:-

Menuitem-tutorial-odoo-8 – Click to enlarge

Hope you learnt how to create an Action and Menuitem in Odoo module in this tutorial, your reviews/comments/suggestions/doubts are most welcomed, please comment in the section below, and subscribe to the newsletter to receive timely future updates of this blog..

I will update how to create Search view soon.

Thank You.


By Burhan Vakharia

Having 6+ years of experience working on Odoo with projects covering several business verticles like Retail industry, Manufacturing, Service, Rental, Education, Medical and many more. I am having experience working on Odoo projects from several countries across the globe.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/odootech/public_html/wp-includes/functions.php on line 4759

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/odootech/public_html/wp-includes/functions.php on line 4759