Skip to content

[20.0][MIG] test_queue_job: Migration to 20.0 - #1021

Open
dhongu wants to merge 27 commits into
OCA:20.0from
dhongu:20.0-mig-test_queue_job
Open

dhongu wants to merge 27 commits into
OCA:20.0from
dhongu:20.0-mig-test_queue_job

Conversation

@dhongu

@dhongu dhongu commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Migration of test_queue_job to Odoo 20.0.

Depends on #999: this branch is stacked on queue_job (#999), so the first commits of this PR are the ones of #999. Only the last commits are specific to test_queue_job:

  • history replayed from 19.0 (git format-patch origin/20.0..origin/19.0 -- test_queue_job | git am -3 --keep)
  • [IMP] test_queue_job: pre-commit auto fixes
  • [MIG] test_queue_job: Migration to 20.0

Main changes:

  • ir.model.access → ir.access
  • test_company_simple / test_company_complex: since 20.0, with_company() leaves the context unchanged for the current company, and keeps the other allowed companies after the given one
  • lint required by the 20.0 template: file-level # ruff: noqa (DTZ001/DTZ005, C408) instead of rewriting the tests, to keep the diff with 19.0 minimal for forward/backward ports

Tested locally on Odoo 20.0 with PostgreSQL 16: test_queue_job installs and all 197 tests of queue_job + test_queue_job pass, with no warning. pre-commit run -a is clean.

Assisted-by: Claude Opus 5.5

guewen and others added 27 commits October 27, 2026 08:01
Add a new "paused" option on channel configuration.
A paused channel is equivalent to a channel with no capacity:
it yields no job and also blocks all its subchannels.

It still needs a restart of the jobrunner, so it does not allow dynamic
pause/resume, but hot reload may be added later in OCA#765.

It still is an improvement over setting the capacity at 0, because it
keeps the capacity in the configuration (removing the option in the
config restores the initial capacity).
Odoo 19 renamed Field._setup_attrs to _setup_attrs__, so the override
was no longer called and an unsupported base_type was silently accepted.
In Odoo 19 res.users.group_ids only holds explicitly assigned groups;
implied ones are exposed through all_group_ids. Users who got Job Queue
Manager through another group were no longer subscribed to failed jobs.
The failure is handled from a temporary cursor while the failed job's
transaction still holds its locks: an on fail hook writing on the same
records waited forever. Perform the job in a savepoint so that its
locks are released when it fails.
odoo shell starts the server with stop=True and stops it right away, so the
runner thread was started for nothing and its START_DELAY made every shell
wait 5 seconds before the prompt. Core already skips its HTTP and cron threads
when stop is set; the runner now follows the same rule.
A runner that lost the master election, or hit an error, slept
ERROR_RECOVERY_DELAY with time.sleep, and the start delay slept
START_DELAY the same way. stop() could not interrupt either, and the
server joins the runner thread on shutdown, so the whole process waited
up to 5 seconds. On hosts that kill a process a few seconds after asking
it to stop, a process whose runner was not the master was killed instead
of exiting.

Both delays now wait on an event that stop() sets.
Neutralized databases disable every cron except the base autovacuum,
so old jobs were never removed there. Replace the dedicated cron with
an @api.autovacuum method, deleting in batches of 1000.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-19.0/queue-19.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-19-0/queue-19-0-queue_job/
- Cancelling a job now cancels its dependents all the way down. Before,
  only direct dependents were cancelled: in A -> B -> C, cancelling A
  left C waiting forever.
  Test: test_button_cancel_dependencies_cascade
- A job is cancelled as soon as one of its dependencies is cancelled.
  Before, it was only cancelled when all of them were, so a job with one
  cancelled and one done (or running) dependency waited forever.
  Tests: test_button_cancel_dependencies_other_parent_done,
  test_button_done_dependencies_other_parent_cancelled
- Cancelled dependents get a date_cancelled, the same as the cancelled
  job. It was left empty, so the autovacuum never removed them.
  Tests: test_button_cancel_dependencies,
  test_button_cancel_dependencies_cascade
- Cancelled dependents get a result telling why they were cancelled.
  Tests: test_button_cancel_dependencies_cascade,
  test_button_cancel_dependencies_selected
- Cancelling a job along with its dependent cancels the dependent once.
  Before, it was cancelled a second time as part of the selection,
  overwriting its date and result.
  Test: test_button_cancel_dependencies_selected

_get_common_dependent_jobs_query is replaced by the searchable
dependency_ids and dependent_ids computed fields on queue.job, used to
enqueue and cancel dependent jobs through the ORM.
Test: test_search_dependencies
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-19.0/queue-19.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-19-0/queue-19-0-queue_job/
- ir.model.access + ir.rule -> ir.access
- registry.clear_cache -> transaction.invalidate_ormcache
- controller: use odoo.sql_db.PG_CONCURRENCY_EXCEPTIONS_TO_RETRY
  (odoo.service.model was removed); env.clear() -> env.transaction.clear()
- jobrunner: odoo.modules.db.list_dbs (odoo.service.db was removed)
- fields: _setup_attrs -> _setup_attrs__; tools.ormcache -> api.ormcache
- JS: job_direct_graph widget ported to Owl 3 (useProps, signal ref);
  get_formview_action -> get_record_default_action (removed in 20.0)
- views: remaining_days widget -> relative_date; stat button icon
- tests: odoo.http.Request -> odoo.http.requestlib.Request
- `Domain.custom(to_sql=...)` now takes a single `table` argument
- `concat()` takes a single iterable
- lint fixes required by the 20.0 template (ruff 0.16, pylint-odoo 10)

Co-authored-by: Jared Kipe <jared@hibou.io>
Assisted-by: Claude Opus 5.5
Neutralized databases disable every cron except the base autovacuum,
so old jobs were never removed there. Replace the dedicated cron with
an @api.autovacuum method, deleting in batches of 1000.
- Cancelling a job now cancels its dependents all the way down. Before,
  only direct dependents were cancelled: in A -> B -> C, cancelling A
  left C waiting forever.
  Test: test_button_cancel_dependencies_cascade
- A job is cancelled as soon as one of its dependencies is cancelled.
  Before, it was only cancelled when all of them were, so a job with one
  cancelled and one done (or running) dependency waited forever.
  Tests: test_button_cancel_dependencies_other_parent_done,
  test_button_done_dependencies_other_parent_cancelled
- Cancelled dependents get a date_cancelled, the same as the cancelled
  job. It was left empty, so the autovacuum never removed them.
  Tests: test_button_cancel_dependencies,
  test_button_cancel_dependencies_cascade
- Cancelled dependents get a result telling why they were cancelled.
  Tests: test_button_cancel_dependencies_cascade,
  test_button_cancel_dependencies_selected
- Cancelling a job along with its dependent cancels the dependent once.
  Before, it was cancelled a second time as part of the selection,
  overwriting its date and result.
  Test: test_button_cancel_dependencies_selected

_get_common_dependent_jobs_query is replaced by the searchable
dependency_ids and dependent_ids computed fields on queue.job, used to
enqueue and cancel dependent jobs through the ORM.
Test: test_search_dependencies
Assisted-by: Claude Opus 5.5
@OCA-git-bot OCA-git-bot added mod:queue_job Module queue_job mod:test_queue_job Module test_queue_job series:20.0 labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:queue_job Module queue_job mod:test_queue_job Module test_queue_job series:20.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants