Odoo 17 Automation Essentials: Understanding the Key Components of Automated Actions

Karan Bishwakarma
6 min readMar 12, 2024

Automated Actions ( aka Automation Rules ) have undergone significant changes in Odoo 17. Although the basic elements and foundation remain the same, this blog uses references and examples for automated actions in Odoo 17. Please refer to the appropriate version for relevant examples.

Automated Actions ( Rules) are a powerful feature that can trigger automatic changes based on user actions (e.g. when user updates a value) or time-based conditions (e.g. alert the salesperson if quotation is not confirmed to order in 7 days of creation). They can automate various business processes and operations, which can enhance productivity and efficiency. In this blog, we’ll take a closer look at the key elements involved in creating an automation.

To create automated actions, you will need to have the base_automation module installed. This module is automatically installed if you have Studio installed in your Odoo system.

For every automated action you create, the following elements should be defined: the Model, the Trigger, the Domain Filter, and the Action. Let’s break down and understand the significance and usage of each of them with an example i.e. create an activity for a salesperson to contact a customer when a phone number is added to the contact details.

Model

The first element to define is the model where the action should be applied. The model represents the database table to which the automation will be linked. In our example, Contact model is selected as this model is used for storing contacts in Odoo.

Trigger

Another integral aspect of automation is defining the correct triggering point. The trigger specifies when the automation will activate. In our scenario, where we want the action to occur when a phone number is added, we utilize the On save triggering point.

Odoo 17 offers five types of triggering points, each serving distinct purposes:

Values Updated

This triggers automation when certain values are set, with predefined conditions based on the selected model. For instance, since a contact can be archived, there’s a predefined trigger point of On archived. This trigger won’t be available for models lacking the Archive option.

Email Events

Automation is triggered when records receive incoming or outgoing messages. For example, alerting individuals when a customer replies to a message.

Timing Conditions

Time-based automation triggers actions at defined times. For instance, creating an activity for a salesperson to call a customer if a quotation isn’t confirmed within 7 days of creation. Adjust the action’s timing by adding minutes, hours, days, or months under Delay after trigger date.

Custom

In the custom section, 3 types of triggering points when a record is modified:

  • On save: Triggers automation when a record is saved. This is equivalent to On Create and Update in previous versions. You can specify fields in the When Updating section for the automation to trigger only when changes occur in those fields.
  • On deletion: Triggers automation when a record is being deleted. This is useful for raising warnings to ensure no critical information is deleted or performing cleanup actions by modifying related data to keep database integrity and consistency.
  • On UI change: Automation is triggered by UI changes i.e. execute every time watched fields change. This is similar to On save but offers more real-time experience without the need to save the record. Add When Updating section to trigger automation when fields relevant to automation is modified.

External

  • On webhook: A webhook serves as a form of integration allowing you to initiate actions in your database when a URL is triggered. Consider a scenario where two Odoo databases interact. In Database A, manual modifications are made, while Database B automatically applies changes through the triggered webhook. For instance, if you alter the salesperson on a sale order in Database A, the same change will be automatically applied to Database B.

Domain Filter

The Domain filter is a crucial element that establishes criteria to filter specific records on which automation should be applied. Similar to applying filters on a model, it helps narrow down the scope of the automation to records meeting specific criteria, preventing irrelevant data from being affected so it’s crucial to provide correct filter.

There are 2 fields available for filtering records: Before Update Domain and Apply On

Before Update Domain

  • This defines the state of a record before any changes are made. Automation will target records that meet these conditions prior to being updated. For instance, a contact should not already have an email assigned, indicating that a new email is being added to the contact rather than updating an existing one.

Apply On

  • This defines the state of a record after changes are made. Automation will target records that meet these conditions to being updated. For instance, the contact must have an email set.

In our example, the automation is set to trigger when a phone number is added for the first time. The applied domain ensures that the automation isn’t triggered with every phone number update.

Action

The final step is defining the action itself, specifying what should happen when certain conditions are met within the specified record sets. There are 10 actions available for automation:

  • Update Record: e.g. Update the mobile number on a contact when the phone field is modified.
  • Create Activity: e.g. Generate an activity for the salesperson to call the customer when a specific event occurs.
  • Send Email: e.g. Automatically send an email to the customer 10 minutes after dispatching the order.
  • Send SMS: e.g. Automatically send an SMS to the customer 10 minutes after dispatching the order.
  • Add Followers: e.g. Add the inventory team as followers when a order is confirmed.
  • Remove Followers (New in version 17): e.g. Remove someone from followers to exclude them from receiving all communication on that document.
  • Create Record: e.g. Generate a quotation when a lead is won.
  • Execute Code: e.g. Trigger a warning message when specific conditions are met.
  • Send Webhook Notification (New in version 17): e.g. Send a webhook notification to another system based on a predefined event.
  • Execute Existing Actions: e.g. Execute a series of existing actions that perform specific tasks.

For our example, we will use the Create Activity action to prompt the salesperson to call the contact with the provided number. Below is a snippet illustrating the action.

Save the automated action. The next time we add a phone number to a contact for the first time, it will generate the specified activity for the salesperson

Conclusion

Automated actions in Odoo 17 are a valuable feature that can streamline business processes and save time. By grasping the fundamental components, users can design customised actions that automates workflow based on specific conditions or user interactions. This level of automation enhances productivity and efficiency within the Odoo system, allowing businesses to focus on critical tasks and improve overall workflow. For more details, refer to the official documentation here, which covers various languages and Odoo versions.

--

--

Karan Bishwakarma

Odoo Developer @ Target Integration | Interested in Business and Technology