Search Here

How to create Action Menu in Odoo

In my previous post you learned about creating and installing a module in odoo. In this article you will learn how to create an action menu. Before going to start our lesson we need to know about "Action Menus".

Action Menu in Odoo

      Menus are record in the table, and the action defines the behavior of the system in response to the action of the users. Action can be triggered by different ways, first one is by clicking on menu items for example we linked our menu with a specific action. Second is by clicking on button and the button exists on some views. 
There are different types of action (windows action, server action, scheduled action , report, group etc...)

  1. Window: This action will be used for opening a new window.
  2. Report: For printing a report.
  3. Group: Gather some action in one group.

How to create action menu in odoo

       Menus are complex to declare so there is <menuitem> short cut to declare and connect it to the corresponding action menu.

The action must be declared before its corresponding menu in the XML file. Below screen shot shows menu and its corresponding action.

How to create Action Menu in Odoo - Learn OpenERP

ExampleIn this example we will create a menu, and our created menu will triggering the action. 
  1. Create an empty module, below screen shot shows the structure of the module.
Read More: How to Create a Module in Odoo
Read More: Understanding Odoo Module Structure

Odoo Module Structure

2. Now create example_action_menu.xml file in  module_name/views folder in your created module./module_name/views/example_action_menu.xml

3. Add your xml file in the data file of  __openerp.py__ file

In our case it should be:
'data': [
# 'security/ir.model.access.csv',
Now this is the end of this tutorial, today you learned what is action menu and how to create action menus. In my next post you will learn about View (form, tree).  

Post a Comment