In this post we will learn about Odoo actions
Actions define the behavior of the system in response to user actions: login, action button, selection of an invoice, … Actions can be stored in the database or returned directly as dictionaries in e.g. button methods. All actions share two mandatory attributes: 1.Type 2.Name
1. type :
the category of the current action, determines which fields may be used and how the action is interpreted
2. name :
short user-readable description of the action, may be displayed in the client’s interface
Window Actions (ir.actions.act_window):
The most common action type, used to present visualisations of a model through views: a window action defines a set of view types (and possibly specific views) for a model (and possibly specific record of the model).
URL Actions (ir.actions.act_url)
Allow opening a URL (website/web page) via an Odoo action. Can be customized via two fields:
url : the address to open when activating the action
target (default= new) the available values are :
new: opens the URL in a new window/page
self: opens the URL in the current window/page (replaces the actual content)
download: redirects to a download URL
Example:
{ "type": "ir.actions.act_url", "url": "https://odoo.com", "target": "self", }
Server Actions (ir.actions.server)
Server actions model. Server action work on a base model and offer various type of actions that can be executed automatically, for example using base action rules, of manually, by adding the action in the ‘More’ contextual menu.
The available actions are :
‘Execute Python Code’: a block of python code that will be executed
‘Create a new Record’: create a new record with new values
‘Write on a Record’: update the values of a record
‘Execute several actions’: define an action that triggers several other server actions
Report Actions (ir.actions.report)
Triggers the printing of a report. If you define your report through a <record> instead of a <report> tag and want the action to show up in the Print menu of the model’s views, you will also need to specify binding_model_id from Bindings. It’s not necessary to set binding_type to report, since ir.actions.report will implicitly default to that.
Client Actions (ir.actions.client)
Triggers an action implemented entirely in the client.
Client Actions (ir.actions.client) in Odoo refer to actions that are executed on the client-side (in the user's browser) in response to user interactions or events. These actions are typically defined in Python code and associated with specific menu items, buttons, or triggers within the Odoo user interface. Client Actions are often used to perform dynamic interactions, such as displaying messages, opening dialogs, executing JavaScript code, or navigating to different views without requiring a server roundtrip.
{ "type": "ir.actions.client", "tag": "pos.ui" }
Automated Actions (ir.cron)
Actions triggered automatically on a predefined frequency. Automated Actions in Odoo, also known as ir.cron (short for Information Record Cron), are a feature that allows users to schedule and automate various tasks within the Odoo system. These tasks can include generating reports, sending email notifications, performing database maintenance, updating records, and more.
Mahfujul Hasan
Software Engineer
LinkedIn: https://www.linkedin.com/in/shojibhasan/
Comments
Post a Comment