Search Here

Create Window Action and Menuitem in Odoo13

 In this article, you will learn how to create a window action and menu item in Odoo13. You will also learn different types of actions provided by Odoo13.

Create Window Action and Menuitem in Odoo13

Type of Action in Odoo13


Name Model
Server Actions ir.actions.server (v8)
Window Actions ir.actions.act_window
URL Actions ir.actions.act_url
Client Actions ir.actions.client
Report Actions ir.actions.report (v8)
Automated or Scheduled Actions ir.cron (v8)

In this article, we are going to create window action, rest of the actions are explained later.

What is Window Action

Whenever we click on the menu window action triggers. Window Action is the most commonly used action. When we click on the menu it calls window action, then window action will decide which views (form view, tree view, kanban view) has to be triggered to display model data. 

Below is the code for window action in Odoo13.

Remember to create window action (act_window) we need a model, If you have not created model yet than I have recommended you to create a new model.

Recommend:


Create an Action Window


Open views.xml file under module_name >> views >> views.xml and paste below code, don't forgot to register that file in __manifest.py__.


Create Window Action and Menuitem in Odoo13


Recommend:


Sr.No View Name
1 Form View (v8)
2 Tree or List View (v8)
3 Kanban View

Below table shows purpose of each field in detail. 

Name Description
id Unique XML id for act_window
name Readable Name related to your Menu
res_model Model for this act_window
view_mode Comma separated list of views like (tree,form,kanban)
view_ids By using this we can define different specific views for same model
context By using this we can pass additional information or data to our view
domain To show filtered record, we can pass domain to our view
target To open your view in different mode like (new, current, fullscreen, main or inline)

Create Menuitem


Create a new file menus.xml under module_name >> views >> views.xml and paste below code, don't forgot to register that file in __manifest.py__.



The above code will create Main Menu, and different Sub Menus as you can show in the above image.

Post a Comment

0 Comments