Enable Dark Mode!
the-ultimate-guide-to-action-types-in-odoo-19.jpg
By: Anjhana AK

The Ultimate Guide to Action Types in Odoo 19

Technical Odoo 19 Odoo Enterprises Odoo Community

In Odoo, actions are the building blocks that tell the system what to do when a user clicks a button, opens a menu item, or triggers an automation. Whether it’s displaying records, generating a PDF, opening a website, or running backend logic—actions are at the core of how Odoo responds to user activity.

With Odoo 19, the types of actions remain consistent, but understanding them clearly will help you customize workflows more effectively. Let’s go through the different types of actions and see how they work.

1. Window Actions (ir.actions.act_window)

The most common type of action, used to display a model’s data in different views (list, form, kanban, etc.).

Key Properties:

  • res_model: Model to display.
  • views: View types and order.
  • domain: Filter applied to the records.
  • context: Default values or extra parameters.
  • target: Defines where the view opens (same page, popup, etc.).

Example – Open All Sale Orders Pending Confirmation:

{
   "type": "ir.actions.act_window",
   "res_model": "sale.order",
   "views": [[False, "list"], [False, "form"]],
   "domain": [["state", "=", "draft"]],
   "name": "Pending Quotations"
}

This opens quotations that haven’t yet been confirmed, starting in list view.

2. URL Actions (ir.actions.act_url)

URL actions redirect users to a web address—useful for linking to external systems, dashboards, or downloadable files.

Key Properties:

  • url: The link to open.
  • target: new (new tab), self (same tab), or download.

Example – Redirect to Google Drive Folder:

{
   "type": "ir.actions.act_url",
   "url": "https://drive.google.com/your-folder-id",
   "target": "new",
}

Clicking this action opens a shared Google Drive folder in a new tab.

3. Server Actions (ir.actions.server)

Server actions run logic on the backend—ideal for automation and bulk processing. They can create, update, or delete records, run Python code, or trigger multiple actions at once.

Common Uses:

  • Execute Python code.
  • Send an email.
  • Create or update records.
  • Run multiple server actions in sequence.

Example – Automatically Tag a New Customer as VIP if Credit Limit > 50,000:

<record id="action_vip_customer" model="ir.actions.server">
   <field name="name">Mark VIP Customer</field>
   <field name="model_id" ref="base.model_res_partner"/>
   <field name="state">code</field>
   <field name="code">
if record.credit_limit and record.credit_limit > 50000:
   record.write({"category_id": [(4, ref("your_module.partner_category_vip"))]})
   </field>
</record>

Whenever this action is triggered, eligible customers are automatically marked as VIP.

4. Client Actions (ir.actions.client)

Client actions run directly on the client (frontend). They’re used for interactive features, like opening dashboards, launching apps (e.g., POS), or loading custom widgets.

Key Properties:

  • tag: Defines what the client should do.
  • params: Extra data sent with the action.
  • target: Where the action opens (current, new, or fullscreen).

Example – Launch Project Dashboard Widget:

{
   "type": "ir.actions.client",
   "tag": "project.dashboard",
   "params": {"show_stats": True}
}

This action tells the client to open a custom project dashboard.

5. Report Actions (ir.actions.report)

Used to generate reports (PDF, HTML, etc.), typically available under the Print menu. Reports rely on QWeb templates.

Key Properties:

  • report_name: QWeb template.
  • report_type: Usually qweb-pdf or qweb-html.
  • print_report_name: Dynamic filename logic.
  • paperformat_id: Paper format settings.

Example – Print an Employee Contract as PDF:

<record id="action_report_contract" model="ir.actions.report">
   <field name="name">Employee Contract</field>
   <field name="model">hr.contract</field>
   <field name="report_type">qweb-pdf</field>
   <field name="report_name">your_module.report_contract_template</field>
   <field name="binding_model_id" ref="hr.model_hr_contract"/>
</record>

This adds a Print > Employee Contract option to contracts.

6. Scheduled Actions (ir.cron)

Also called automated actions, these run periodically without user input—perfect for routine jobs.

Key Properties:

  • interval_number & interval_type: Define frequency.
  • model_id: Target model.
  • code: The logic to execute.

Example – Automatically Archive Old Leads (older than 6 months):

<record id="ir_cron_archive_leads" model="ir.cron">
   <field name="name">Archive Old Leads</field>
   <field name="model_id" ref="crm.model_crm_lead"/>
   <field name="state">code</field>
   <field name="code">
model.search([("create_date", "&lt;", (datetime.now() - timedelta(days=180)))])
    .write({"active": False})
   </field>
   <field name="interval_number">7</field>
   <field name="interval_type">days</field>
   <field name="active" eval="True"/>
</record>

Every week, Odoo checks for leads older than 6 months and archives them.

Odoo 19’s action framework makes the platform flexible and powerful. From simple navigation actions to fully automated backend processes, actions help you bridge user interaction with business logic.

  • Use Window Actions for navigation.
  • Use URL & Client Actions for external links or UI experiences.
  • Use Server & Scheduled Actions for automation.
  • Use Report Actions to generate business documents.

With these, you can design workflows that match your exact business needs.

To read more about What are the Types of Actions in Odoo 18, refer to our blog What are the Types of Actions in Odoo 18.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message