Skip to content

Actions: Automation in Odoo

The Power of "It Just Happens"

Your client says: "When a lead is marked as won, I want a project to be created automatically, the account manager notified, and the lead data synced to our accounting software."

Without code, you can make all of this happen. Odoo's action system is one of the most powerful tools for functional consultants.

Three Types of Automation Actions

TypePurposeTriggerLocation
Server ActionsManual actions from UIUser clicksSettings > Technical > Actions > Server Actions
Scheduled ActionsTime-based recurring tasksCron scheduleSettings > Technical > Automation > Scheduled Actions
Automated ActionsEvent-driven rulesRecord changesSettings > Technical > Automation > Automated Actions

Server Actions (ir.actions.server)

Server Actions are manual actions that users trigger from the UI. They appear in the "Actions" menu or can be added as buttons.

Action Types Available (Odoo 19)

Action TypeTechnical StateWhat It DoesExample Use Case
Update Recordobject_writeModify field values on recordsBulk assign salesperson, Mark as priority
Create Recordobject_createCreate new record with valuesCreate task from lead
Duplicate Recordobject_copyCopy an existing recordClone template records
Execute CodecodeRun custom Python codeComplex calculations, integrations
Send WebhookwebhookPOST data to external URLNotify external system
Multi ActionsmultiExecute multiple child actionsUpdate + email + create task

Additional Action Types (from modules)

When you install additional modules like Discuss (mail), SMS, or others, more action types become available:

  • Send Email - Send email using template (requires mail module)
  • Add Followers - Add users as followers (requires mail module)
  • Create Next Activity - Schedule follow-up activity (requires mail module)
  • Send SMS - Send SMS messages (requires sms module)

Example: Mark Leads as High Priority

Scenario: Sales manager wants a quick action to mark selected leads as high priority.

  1. Go to Settings > Technical > Actions > Server Actions
  2. Click Create
  3. Set Name: "Mark as High Priority"
  4. Set Model: CRM Lead (crm.lead)
  5. Set Action Type: Update Record
  6. Add field update: Priority = "3" (High)
  7. Click "Create Contextual Action" to add to Actions menu

Usage: Select leads → Actions menu → "Mark as High Priority"

Example: Send Data to External System

Scenario: Sync won opportunities to accounting software.

  1. Create Server Action on CRM Lead model
  2. Set Action Type: Send Webhook Notification
  3. Set Webhook URL: https://accounting.company.com/api/opportunities
  4. Select Fields to Send: Name, Partner, Expected Revenue, Date Closed

Payload sent:

json
{
  "_id": 42,
  "_model": "crm.lead",
  "_name": "Sync Won Opportunities",
  "name": "Website Redesign Project",
  "partner_name": "TechCorp Solutions",
  "expected_revenue": 250000
}

Incremental Mass Edit (List View Feature)

A built-in list view feature that allows you to update multiple records using mathematical operators.

Supported Operators

OperatorMeaningExampleResult (if current = 100)
+=Add to current value+=10110
-=Subtract from current-=2575
*=Multiply current value*=1.15115 (15% increase)
/=Divide current value/=250

Example: 10% Price Increase

  1. Go to Sales > Products > Products
  2. Select products to update (checkbox)
  3. Click on the Sales Price column header
  4. Enter: *=1.10
  5. Confirm the update

Result: Each selected product's price increases by 10%.

Scheduled Actions (ir.cron)

Scheduled Actions run automatically at specified intervals. Perfect for maintenance, reports, and batch processing.

Scheduling Options

Interval TypeExampleUse Case
MinutesEvery 15 minutesReal-time monitoring
HoursEvery 2 hoursRegular sync jobs
DaysEvery 1 day at 9:00 AMDaily reports
WeeksEvery MondayWeekly summaries
MonthsFirst of monthMonthly billing

Key Configuration Fields

FieldPurpose
Execute EveryInterval value (e.g., "2" hours)
Interval UnitMinutes, Hours, Days, Weeks, Months
Next Execution DateWhen it will run next
Number of Calls-1 = unlimited, or specific count
PriorityLower number = higher priority
ActiveMust be checked to run

How Scheduled Actions Work

  • Execution: Runs in background worker thread
  • User Context: Runs as the "OdooBot" user
  • Failure Handling: After 5+ consecutive failures over 7+ days, auto-deactivates
  • Manual Trigger: Use "Run Manually" button to test
  • Concurrency: Only one instance runs at a time (prevents overlap)

Example: Send Daily Report

  1. Create Scheduled Action
  2. Set Model: Sale Order (sale.order)
  3. Set Execute Every: 1 Day
  4. Set Next Execution Date: Tomorrow at 9:00 AM
  5. Create Server Action: Execute Code → Generate and email report

Automated Actions (base.automation)

Automated Actions trigger automatically when specific events occur. They're the backbone of workflow automation.

Trigger Types (Odoo 19)

TriggerTechnical NameWhen It RunsExample Use Case
Stage is set toon_stage_setSpecific stage reachedCreate project when won
User is seton_user_setResponsible assignedNotify assignee
Tag is addedon_tag_setSpecific tag addedNotify when "urgent"
State is set toon_state_setState field changesCreate invoice on confirm
Priority is set toon_priority_setPriority changesAlert on high priority
On archivedon_archiveRecord archivedLog archival, cleanup
On unarchivedon_unarchiveRecord restoredRe-enable subscriptions
On createon_createNew record createdAssign leads to salesperson
On create and editon_create_or_writeCreated or modifiedValidate data
On updateon_writeRecord modified (deprecated)Use "On create and edit" instead
On deletionon_unlinkBefore record deletedArchive instead of delete
On UI changeon_changeField changed in formReal-time validation
Based on date fieldon_timeX time before/after dateReminder before deadline
After creationon_time_createdX time after createdFollow-up email 7 days later
After last updateon_time_updatedX time after modifiedReminder for stale records
On incoming messageon_message_receivedEmail/message receivedAuto-reply (requires mail)
On outgoing messageon_message_sentEmail/message sentLog communications (requires mail)
On webhookon_webhookExternal HTTP requestReceive external data

Before/After Update Filters

For "On Update" triggers, use these domains to detect specific changes:

FilterPurposeExample
Before Update FilterState before change[('state', '=', 'draft')]
After Update FilterState after change[('state', '=', 'sale')]
Trigger FieldsOnly trigger for these fields['state', 'user_id']

Example: Auto-Assign Leads by Region

  1. Create Automated Action on CRM Lead
  2. Set Trigger: On Create
  3. Set Apply on: [('state_id.name', '=', 'Maharashtra')]
  4. Add Server Action: Update Record → Sales Team = "Pune Regional"

Result: Leads from Maharashtra automatically assigned to Pune team.

Example: Escalate Unassigned Tickets

  1. Create Automated Action on Helpdesk Ticket
  2. Set Trigger: After creation (2 hours)
  3. Set Apply on: [('user_id', '=', False)]
  4. Add Server Action: Send Email to manager + Update priority

Result: Unassigned tickets escalate after 2 hours.

All Action Types Reference

Odoo has seven distinct action types. While automation actions are most common, understanding all types helps with customization:

Action TypeTechnical ModelPurpose
Window Actionsir.actions.act_windowOpen views, navigate between records
Server Actionsir.actions.serverExecute business logic
URL Actionsir.actions.act_urlOpen external URLs, downloads
Client Actionsir.actions.clientCustom JS widgets, dashboards
Report Actionsir.actions.reportGenerate PDF/HTML reports
Window Close Actionsir.actions.act_window_closeClose dialog windows
Scheduled Actionsir.cronTime-based recurring tasks

Window Actions (ir.actions.act_window)

Window Actions open views and are used for:

  • Menu items linking to list/form views
  • Smart buttons that navigate to related records
  • Action buttons that open specific records
  • Wizards (transient models in popup)

Key fields:

FieldPurposeExample
res_modelModel to displaysale.order
domainFilter which records to show[('state', '=', 'sale')]
contextPass default values, flags{'default_partner_id': active_id}
view_modeAvailable views (comma-separated)list,form,kanban,calendar
targetWhere to opencurrent, new (popup), fullscreen, main
res_idSpecific record ID (form view)42
limitDefault list view limit80
view_idSpecific view to useReference to ir.ui.view

Target options:

  • current - Replace current view (default)
  • new - Open in modal/popup dialog
  • fullscreen - Full browser window
  • main - Main content area only

URL Actions (ir.actions.act_url)

URL Actions open external URLs or trigger downloads.

Key fields:

FieldPurposeValues
urlTarget URLAny valid URL or download path
targetHow to opennew (new tab), self (same tab), download

Common use cases:

  • Open external documentation: https://docs.example.com
  • Download files: /web/content/model/id/field/filename
  • Open external applications: mailto:, tel:

Example - Download attachment:

python
return {
    'type': 'ir.actions.act_url',
    'url': '/web/content/%s/%s/datas/%s' % (model, record.id, filename),
    'target': 'download',
}

Client Actions (ir.actions.client)

Client Actions execute custom JavaScript code in the browser. Used for dashboards, custom widgets, and special interfaces.

Key fields:

FieldPurposeExample
tagClient-side action identifierboard.board, mail.action_discuss
contextData passed to JS{'default_model': 'sale.order'}
paramsAdditional parametersCustom JS configuration
res_modelOptional related modelFor needaction badges

Built-in client actions:

  • board.board - Dashboard display
  • mail.action_discuss - Discuss/messaging interface
  • website.action_website_edit - Website editor
  • account_dashboard.action_account_dashboard_main - Accounting dashboard

Report Actions (ir.actions.report)

Report Actions generate PDF, HTML, or text reports using QWeb templates.

Key fields:

FieldPurposeValues/Example
modelModel the report applies tosale.order
report_typeOutput formatqweb-pdf, qweb-html, qweb-text
report_nameQWeb template namesale.report_saleorder
print_report_nameDownloaded filename'SO - %s' % object.name
paperformat_idPaper size/marginsReference to report.paperformat
attachmentSave as attachment'SO_%s.pdf' % object.name
attachment_useReuse saved attachmentTrue/False

Report types:

  • qweb-pdf - PDF via wkhtmltopdf (most common)
  • qweb-html - HTML rendered in browser
  • qweb-text - Plain text output

Example - Print Sales Order:

xml
<record id="action_report_saleorder" model="ir.actions.report">
    <field name="name">Sales Order</field>
    <field name="model">sale.order</field>
    <field name="report_type">qweb-pdf</field>
    <field name="report_name">sale.report_saleorder</field>
    <field name="print_report_name">'Sale Order - %s' % (object.name)</field>
    <field name="binding_model_id" ref="model_sale_order"/>
    <field name="binding_type">report</field>
</record>

Comparing the Three Automation Types

FeatureServer ActionsScheduled ActionsAutomated Actions
TriggerManual (user clicks)Time-based (recurring)Event-driven (automatic)
When to useUser controls whenRegular maintenanceRespond to changes
Runs onSelected recordsAll matching (batch)Individual record
User contextCurrent userScheduler userUser who triggered
VisibilityActions menu, buttonsBackgroundBackground
PerformanceOnly when runPeriodicEvery matching change

Choosing the Right Action Type

Use Server Actions when:

  • Users need to decide when to run
  • Works on multiple selected records
  • Should not happen automatically
  • Examples: Bulk updates, export data, custom workflows

Use Scheduled Actions when:

  • Needs to run at specific intervals
  • Batch processing is more efficient
  • Maintenance-related (cleanup, sync, reports)
  • Examples: Daily reports, nightly sync, monthly billing

Use Automated Actions when:

  • Response should be immediate
  • Rule should apply consistently
  • Workflow needs to progress automatically
  • Examples: Lead assignment, notifications, escalations

Best Practices

Automation Best Practices

  • Use precise domains: Don't trigger on all records; filter to relevant ones
  • Avoid infinite loops: Be careful when automation updates fields that trigger other automations
  • Specify trigger fields: For "On Update", list specific fields to avoid unnecessary triggers
  • Test thoroughly: Use test records to verify automation works
  • Keep it simple: Complex logic is better in custom code
  • Document rules: Use Description field to explain purpose
  • Monitor performance: Too many automation rules can slow saves

Knowledge Check

Q1: Which action type for "10% price increase on selected products"?

Answer: Server Action (Update Record)

Server Actions work on selected records from the Actions menu. Use the incremental mass edit feature (*=1.10) for the actual update.

Q2: Which action type for "Send daily sales report at 9 AM"?

Answer: Scheduled Action

Scheduled Actions run at specified intervals. Set to run daily at 9 AM with a Server Action that generates and emails the report.

Q3: Which action type for "When lead is won, create project"?

Answer: Automated Action

Automated Actions respond to events. Use "Stage is set to" trigger with the "Won" stage, then Create Record action.

Q4: How to detect state change from draft to confirmed?

Answer: Before Update Filter + After Update Filter

Set Before: [('state','=','draft')] and After: [('state','=','sale')] to catch that specific transition.

Q5: Why might an automated action cause performance issues?

Answer: It runs on every matching record change

Unlike scheduled actions (periodic) or server actions (manual), automated actions fire on every save. Too many or complex ones slow down all saves.