Type of action in odoo

Hello Odooers, Odoogig and Odoo Lovers,

In this Odoo  Technical Tutorial, I would like to explain about what Type of action in odoo  in detail with code  example

In odoo there are five type of action  mentioned below :

1. Window Action : (It’s Triger the Different View of model)
2. URL Action : Open URL using odoo action
3. Server Action:  triggering the server code
4. Report Action :Triggering the print Report
5. Client Action : Triggers an action implemented entirely in the client.

Let’s see all odoo action in detailed

1. Window Action ( ir.actions.act_window ):

A window action interact  to the web interface and it’s used by menu items or
buttons in views. window action will tell to which model to work and what relevant views to make it available.The most common type of action is window action. it will also show model views based on context and domain pass in action.

Window Actions will be defined in XML files using the <act_window> shortcut.

odoo window action  exmple:

Attributes for window actions

id :  id will be always uniq for every window action
name: name of action which you would like to define and it will display on view side
res_model : it’s  a targeted model to show action
search_view_id (optional) : if you want to define specific search view to load action or it will take  default search view load
target (optional) :    there is 2 type of target in odoo window action
new:  it will open pop-pu window into new window
current : it will open a view into inline current window
context (optional) : context is dictionary  format which contain information of the target views , which can be load default to view/window
domain (optional):  pass domain for specific condition or filter based record will be load in views
Limit (optional ): number of record wan to display in list by default, odoo by default it’s 80 for list view
view_mode :  All view types available for the action and it’s define  as string format in comma separated to load views/list from action.first one will be load by default.
view_id : to open a specif view after load

Name, res_model, view_type and view_mode are required field in window action.

2. URL Action ( ir.actions.act_url ) :

URL action is used to open url using odoo action .

Attributes of URL Action:
url : Address url to pass

3. Server Action ( ir.actions.model ):
In odoo, server action will be used to automated task . it’s allow to triggering the Server code from any action with specific condition and time based on call.

Bellow attributes used in server action .
Id : identify the server action in database
context (optional): it will open a view into inline current window
model_id : model liked to the server action
condition (optional): condition is default True,
when you define then evaluate the action based on condition
code : python code to be execute when sever action call

 

4. Report Action ( ir.actions.report.xml ) :

In odoo, Report action will be used to print a xml report.

attributes used in Report Action :
name : Name of the report will be display on views
model : Model liked to the report
report_type: type of report to print qweb-pdf or qweb-html
report_name: name of the report pdf
groups_id: groups allows to print report
paperformat_id: paper format liked to the report which paper formatted used to the report
attachment_use: if true then report will be generated first time then after re-print from the storage
attachment : python expression that define the name of the report. file : id of the report xml view
like module_name.sale_report_template

5. Client Action :
In odoo, cleint action will be used to  execute the code on client side.

attributes used in client action.
Tag: tag as string format which identify the client action
params: python dictionary of additional data send to the client .data map of the key and value send to the client

 


GET IN TOUCH.!

We’d Love to Hear from You! We are happy to answer any questions, you have regarding My Training.

Mail : getodootraining@gmail.com

Skype : mayur_maheshwari1

What’s app : +919924542042

LEAVE A REPLY

Leave a Reply

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