Skip to main content
iVentureTeam
Odoo Upgrades

Odoo Scheduled Actions in Odoo 19 and 20: ir.cron, Batching and Fixes

Odoo scheduled actions explained for Odoo 19 and 20: ir.cron in the UI vs code, safe batching, timezone rules, why a cron is not running, and failures.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
November 18, 202611 min read4 views
Odoo Scheduled Actions in Odoo 19 and 20: ir.cron, Batching and Fixes cover

Most guides stop at "add a record and set an interval". The hard part is the 2 a.m. run that meets 80,000 records. Our Odoo development company team writes jobs that survive that, checked here against the 19.0 and 20.0 source.

Related service: Odoo upgrade services — version upgrades with custom modules ported and tested.

This is for developers, technical leads and admins who own background jobs. If you need "when a record changes, do X", read our guide to Odoo automation rules in Odoo 19 and 20; this post covers timed and batch work.

What is an Odoo scheduled action (ir.cron)?

An Odoo scheduled action is an ir.cron record that runs an "Execute Code" server action at a set interval. The model inherits from ir.actions.server, so every scheduled action is also a server action with a model and a code field.

You find them in developer mode under Settings, Technical, Automation, Scheduled Actions. Key fields on the form:

FieldWhat it controlsDefault in 19.0 and 20.0
Scheduler UserWhose rights and timezone the job usesThe user who created it
Execute EveryGap between runs, minutes to months1 month
Next Execution DateWhen the job is next due, stored in UTCNow
Last Execution DateLast successful run, passed to the codeEmpty
PriorityOrder when several jobs are due; 0 runs first5
Failure countConsecutive failures, reset on success0

"Number of Calls" and "Repeat Missed" exist in 17.0 but were removed in 18.0, so "set Number of Calls to -1" advice does not apply to 19 or 20.

Odoo automation rules vs scheduled actions: which one do you need?

Automation rules vs ir.cron: Which tool fits your background job?

Use an automation rule when a record event should cause the action, and a scheduled action when time or volume should drive it.

Older guides say automated actions vs scheduled actions; same question.

QuestionAutomation ruleScheduled action (ir.cron)
What starts itCreate, update, stage change, date field, webhookA timer, or a trigger from code
ScopeThe records that changedAny records you search for
VolumeSmall, per eventLarge, in batches
Who builds itFunctional admins, Studio usersDevelopers
TestingManual on sample recordsUnit tests with method_direct_trigger

Time-based automation rules run through a scheduled action called "Automation Rules: check and execute". It ships inactive with a 4-hour interval, and Odoo turns it on and shortens it to a tenth of your shortest rule delay, never below 1 minute.

So a delayed rule that never fires is often a cron problem. See enterprise workflow automation for where each layer fits.

Should you create a scheduled action in the UI or in code?

Create it in the UI only for a one-line call or a short test, and ship anything you depend on as a module with an XML record and a Python method.

  • UI is fine for: a one-line call to an existing method, a staging test, or a clean-up you will archive next week.
  • Code is right for: loops, external calls, logic that must match on every database, and anything needing tests and review.

A module record looks like this. Keep the code field to one method call:

```xml Purchase: sync vendor prices code model._cron_sync_vendor_prices() 1 hours ```

Wrap it in `` if admins may change the interval, so a module update does not reset it. Our Odoo module development guide covers data file basics.

How do you batch an Odoo cron job safely?

Process a limited batch per call, report it with `_commit_progress()`, and let the scheduler call the method again until nothing remains. The Odoo 20 scheduled actions reference says a batch should take no more than "a few seconds" and not to reschedule the job yourself.

```python def _cron_sync_vendor_prices(self, limit=200): domain = [('price_sync_needed', '=', True)] records = self.search(domain, limit=limit) records._sync_vendor_price() remaining = (0 if len(records) < limit else self.search_count(domain)) self.env['ir.cron']._commit_progress( len(records), remaining=remaining) ```

What the 19.0 and 20.0 scheduler does with that call:

  1. It runs your server action in its own cursor and tracks a progress record.
  2. `_commit_progress()` stores done and remaining counts and commits, so finished batches stay saved.
  3. While work remains, it calls the action again in the same run.
  4. It stops after at least 10 calls and a minimum time: 10 seconds in 19.0, 120 seconds in 20.0.
  5. If records still remain, the job is "partially done" and requeued once other due jobs have had a turn.
  6. When remaining hits 0, or the code never reports progress, the job is "fully done" and waits for its next interval.

`_commit_progress()` returns the seconds left; if you loop yourself, stop at 0. Odoo 20 adds `_rollback_progress()` for a failed record, and `_notify_progress()` is deprecated since 19.0.

Make each batch idempotent, and filter on a field the batch changes.

How does timezone affect Odoo scheduled actions?

The next execution date is stored in UTC, but Odoo adds the interval in the scheduler user's timezone, so a 06:00 job stays at 06:00 local across daylight saving. The source comment says the interval "won't be fixed, but the hour will stay the same".

The timezone comes from the scheduler user's preferences. If that user has none, Odoo uses UTC and a daily job shifts an hour when clocks change. Set it on the scheduler user, often OdooBot, first.

  • "Today" in code: `fields.Date.today()` uses the server date; use `fields.Date.context_today(record)` for a local date.
  • Missed runs: after downtime, Odoo moves the next date past now and runs the job once, not once per missed interval.
  • Time windows: use `lastcall` from the context to process everything since the last successful run.

Why is my Odoo cron not running?

Most "Odoo cron not running" cases come down to an inactive job, a job that keeps failing, a neutralized copy, a busy cron worker or a server that never starts cron workers.

SymptomLikely causeFix
Job archived on its own5 failures in a row over 7+ daysFix the logged error, reactivate
Next date stuck in the pastNo cron worker reaches this databaseCheck max_cron_threads and the database list
Works with Run Manually onlyCode raises an error, or user lacks rightsRead the traceback, check the scheduler user
All jobs off on a copyDatabase was neutralizedRe-enable only the jobs you need
Skipped after module updateModules stuck "to upgrade"Finish or cancel the update

One Odoo forum user found their scheduled action ran manually but not automatically. The code ended by raising a UserError to show log lines, which rolls back the transaction, so every run failed.

On self-hosted servers, check the Odoo command-line reference. `--max-cron-threads` defaults to 2, and `--db-filter` does not limit cron workers, so without `--database` they poll every database.

Cron workers wake every 60 seconds, or sooner when a trigger is due. If one long job holds both workers, the rest wait. Our Odoo performance tuning checklist covers worker sizing.

What happens when an Odoo scheduled action fails or times out?

A failed run rolls back, counts as a failure and the job waits for its next interval; after enough failures over enough days, Odoo switches it off. The Odoo 19 scheduled actions docs list the safety rules.

  1. Timeouts: after 3 consecutive timeouts with no progress, the next run is skipped and counted as failed.
  2. Deactivation: at 5 failures, with the first more than 7 days old, the job is set inactive and the admin is notified.
  3. Early warning in 20.0: Odoo 20 adds a "will be deactivated if you don't take action" notice first.
  4. Hard limit: `--limit-time-real-cron` kills the run; by default it falls back to `--limit-time-real` (120 seconds).
  5. Partial progress: a run that committed progress and then crashed is "partially done", not failed.

The base `_notify_admin()` only writes to the server log, so on a self-hosted server nobody sees it unless you watch logs. A regular Odoo health check catches archived jobs early.

How do Run Manually and triggers work in Odoo 19 and 20?

"Run Manually" runs the job now through the normal scheduler path, and `_trigger()` asks the scheduler to run it soon or at a set time without changing its interval.

Run Manually needs write access and refuses to start if a worker is already running the job. It runs in your browser request, so test a small batch.

From code, call `_trigger()` on the cron record after a user action creates work, with an optional datetime or list of datetimes. Odoo 20 adds a `coalesce` window in minutes to group triggers into fewer wake-ups. While a job runs, editing it raises "Record cannot be modified right now".

How do scheduled actions behave on staging, Odoo.sh and neutralized databases?

Neutralizing a database switches off every scheduled action except the base auto-vacuum job, so copies do not email customers or call real APIs.

The Odoo.sh branches documentation says staging copies are neutralized and crons run less often when nobody uses the database. On development branches they do not run while the database is idle.

On a neutralized database, re-enable only the job you test and point its connectors at a sandbox. Our Odoo staging environment checklist has the full list.

Which scheduled actions matter most by industry?

The scheduled actions that hurt most when they stop are the ones tied to money, stock and compliance deadlines.

IndustryPain or cost driverOdoo approachHow iVentureTeam helps
ManufacturingStale cost prices on quotes and POsHourly batched price syncBuild the sync with progress reporting
DistributionReordering misses a nightMonitored reorder cronsAdd failure alerts and log reviews
eCommerceOrder and stock sync backlogBatched imports with triggersTune batch size and workers
SubscriptionsRenewal invoices not createdDaily cron in the right timezoneFix scheduler user timezone and rights
FinanceE-invoice status checks pile upPolling cron with retriesAdd idempotent retries and alerts

How iVentureTeam helps with Odoo scheduled actions

Archived crons? Run a health check

iVentureTeam writes, audits and repairs Odoo scheduled actions so background jobs run on time and fail loudly, not silently. We have delivered 150+ ERP projects across 35+ countries with 40+ Odoo specialists, led by a consultant with 13+ years in Odoo.

  • Cron audit: every active and archived job, its failure history, scheduler user and timezone.
  • Batch rewrites: long jobs moved to `_commit_progress()` batches for Odoo 19 and 20.
  • Custom modules: our Odoo customization services turn UI-made jobs into tested module code.
  • Ongoing care: our Odoo ERP support team watches logs and fixes jobs before they switch off.

Odoo scheduled actions case study: Mechanical Products IL

A US precision components maker used scheduled actions to keep cost prices in sync, on Odoo 17 rather than 19 or 20. It predates the 19.0 progress API, so the batching code above was not used, but the design idea is the same.

Mechanical Products IL ran its product catalog on manual Excel imports. Cost prices did not update on import, so quotations and purchase orders went out with stale numbers.

We built a product-lifecycle module that creates, updates and archives products from the sheet. Scheduled actions keep standard_price fields in sync, and POs pull the latest vendor price. It took 6 weeks; see the Mechanical Products IL product data automation case study.

The bottom line on Odoo scheduled actions

Treat every Odoo scheduled action as production code: small batches, reported progress, a scheduler user with the right rights and timezone, and someone watching for failures.

Ship jobs in a module, test with Run Manually on a small batch, and review archived jobs monthly. For AI-driven background work, see our guide to automating Odoo workflows with AI.

Ready to fix the scheduled actions that keep failing?

Get a cron review

Send us the job names and the last traceback, and we will tell you what is wrong. Get your Odoo cron jobs reviewed by a developer, call +91-90235-15208, or email business@iventureteam.com.

Frequently Asked Questions

What is a scheduled action in Odoo?

+

It is an ir.cron record that runs an "Execute Code" server action at a set interval, as a chosen scheduler user. You manage them in developer mode under Settings, Technical, Automation, Scheduled Actions.

How do I create a scheduled action in Odoo 19?

+

In developer mode, open Settings, Technical, Scheduled Actions and click New. Pick the model, write one line calling a method, set the interval and scheduler user, and save. For anything lasting, define it in a module.

Why is my Odoo scheduled action not running automatically?

+

Check that it is active, that its code does not raise an error, that the scheduler user has rights, and that cron workers run for that database. On copies, neutralization may have switched it off.

What is the difference between automation rules and scheduled actions in Odoo?

+

Automation rules react to record events such as create, update or a date field. Scheduled actions run on a timer and process any records in batches. Time-based rules themselves run through a scheduled action.

Does Odoo run missed scheduled actions after downtime?

+

No. Odoo moves the next execution date past the current time and runs the job once. "Repeat Missed" was removed in Odoo 18, so write code that processes everything since the last run.

What timezone do Odoo cron jobs use?

+

The next execution date is stored in UTC, and the interval is added in the scheduler user's timezone, so daily jobs keep their local hour. If that user has no timezone, Odoo uses UTC.

Why did Odoo deactivate my scheduled action?

+

Odoo archives a job after 5 consecutive failures when the first is more than 7 days old. Find the traceback in the server log, fix the cause, then reactivate the job.

Free Odoo implementation plan

Planning your Odoo implementation?

A senior consultant reviews your processes and sends a phased roadmap, what to set up first and a fixed-price range.

Free, with no obligation. A senior consultant replies within 12 business hours.

We use cookies to improve your experience

Essential cookies make the site work, and we use analytics to improve it. Choose “Only necessary” to turn analytics off. See our cookie policy.