Skip to content

Getting Started

Requirements

  • Odoo 19.0
  • PostgreSQL 12+ (including PostgreSQL 18)
  • Python 3.11+

Installation

Place the job_worker directory (and optionally job_worker_monitor, job_worker_demo) in your Odoo addons path, then install:

odoo -d <db_name> \
  --addons-path=/path/to/odoo/addons,/path/to/job-worker-modules \
  -i job_worker \
  --stop-after-init

Or install via the Odoo UI: Apps > Search "Job Worker" > Install.

Start a Worker

The worker is a standalone process that pulls and executes jobs. Create a launcher script:

# run_worker.py
import odoo
from odoo.tools import config

from odoo.addons.job_worker.cli.worker import QueueWorker

config.parse_config([
    "-c", "/etc/odoo/odoo.conf",
    "-d", "<db_name>",
])

odoo.service.server.load_server_wide_modules()
registry = odoo.modules.registry.Registry(config["db_name"])

worker = QueueWorker(config["db_name"])
worker.run()
python run_worker.py

See Deployment for production setup with Docker, systemd, and the multi-database runner.

Enqueue Your First Job

In any Odoo server action, cron, or Python shell:

Using with_delay()

partner = env["res.partner"].browse(1)
job = partner.with_delay(priority=5, channel="default").write({"name": "Hello from the queue!"})

The method call is captured and stored as a job record. The worker picks it up and executes partner.write({"name": "Hello from the queue!"}) in the background.

Using delayable()

partner = env["res.partner"].browse(1)
delayable = partner.delayable(priority=5, channel="default")
delayable.write({"name": "Hello from the queue!"})
job = delayable.delay()

The delayable() form is useful when you need to compose jobs into graphs before enqueuing.

Using the Direct API

job = env["queue.job"].enqueue(
    model_name="res.partner",
    method_name="write",
    record_ids=[1],
    args=[{"name": "Hello from the queue!"}],
    kwargs={},
    channel="default",
    priority=5,
)

Monitor Jobs

Navigate to Queue Jobs > Jobs in the Odoo menu to see job states, errors, and execution details. Install job_worker_monitor for a dashboard with metrics and alerts.

Next Steps

  • Enqueueing Jobs — Full API reference for with_delay(), delayable(), scheduling, and deduplication
  • Job Graphs — Compose parallel groups and sequential chains
  • Configuration — Channel throttling, worker parameters, and Odoo settings
  • Deployment — Production setup guides