Skip to content

[20.0][MIG] queue_job: Migration to 20.0 - #1

Merged
dhongu merged 1209 commits into
20.0from
20.0-mig-queue_job
Sep 26, 2026
Merged

dhongu merged 1209 commits into
20.0from
20.0-mig-queue_job

Conversation

@dhongu

@dhongu dhongu commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Migrare queue_job 19.0 → 20.0, după fluxul OCA (Migration to version 20.0).

Commit-uri: istoricul modulului replayat din 19.0 (git format-patch | git am -3 --keep) + [MIG] queue_job: Migration to 20.0.

Adaptări

  • upgrade_code: ir.model.access + ir.rule → security/ir.access.csv (7 drepturi + regula multi-company, nicio regulă pierdută); registry.clear_cache → transaction.invalidate_ormcache.
  • HTTP: patch-ul multi-db din post_load mutat pe odoo.http.router._set_session_and_dbname (Request._get_session_and_dbname nu mai există în 20).
  • Controller: PG_CONCURRENCY_ERRORS_TO_RETRY definit local (eliminat din odoo.service.model); env.clear() → env.transaction.clear().
  • Jobrunner: odoo.modules.db.list_dbs (odoo.service.db eliminat).
  • fields.py: _setup_attrs → _setup_attrs__; tools.ormcache → api.ormcache.
  • JS: widget-ul job_direct_graph portat la Owl 3 nativ (useProps, signal.ref, ActionPlugin) — owl3-migration produsese importuri inexistente și ActionManagerPlugin (bug în maparea din upgrade_code).
  • View: widget-ul remaining_days → relative_date.

De confirmat înainte de merge: regula globală multi-company queue_job_comp_rule devine un rând ir.access fără grup, cu același domeniu; în 19 era noupdate=1, acum se actualizează la fiecare upgrade de modul.

Pentru modulele dependente: queue_job_cron_jobrunner importă odoo.service.model.PG_CONCURRENCY_ERRORS_TO_RETRY → de mutat pe odoo.addons.queue_job.controllers.main la migrarea lui.

Verificare

  • Rescrieri automate: upgrade_code (19.x + owl3-migration) și rescrierile proprii prin scripts/mig_upgrade_code.py; verificările de API (semnături core 19↔20, API-uri eliminate) fără poziții rămase.
  • Verificare de aliniere funcțională 19.0 ↔ 20.0: nicio funcționalitate pierdută.
  • Instalat pe Odoo 20 (baza test20) și rulate testele modulului: 68 teste OK.

🤖 Generated with Claude Code

simahawk and others added 30 commits September 26, 2026 13:37
Use case:

* you have a root channel per scope/app (eg: root.edi)
* you have several sub channels (eg: root.edi.ubl.sales,
root.edi.gs1.delivery)
* you want to configure capacity only for the main channel "root.edi"

Before this change, the channel manager falls back on root channel.
However, if you have a specific parent channel configured
it sounds a good idea to use it.
Contributing since a while... :)
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-15.0/queue-15.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-15-0/queue-15-0-queue_job/
test_queue_job will create channels root.sub and root.sub.sub, so the
tests doing the same thing will fail with a unique constraint error.
When displayed in a tab, the widget show the nodes offset, the d3
network is probably confused by the size or visibility of its canvas.
Install a listener on tabs to trigger a fit() on the network.
A graph of jobs always share the same graph_uuid, which can be
used to group jobs, but is also a faster way to find all the jobs
of the graph. Then we can use the dependencies field to build the
whole graph from the pre-selection of jobs.
Jobs waiting that their dependencies are executed cannot be requeued.
They have to keep waiting their turn.
* mock_jobs context manager with assert methods to check enqueued jobs
* jobs are not stored in database, yet they can be inspected and performed
  during the test
* the context manager works with graphs enqueued by delayable and with with_delay()
* direct execution of jobs works with graphs by executing them synchronously
  following their topological sort
OCA-git-bot and others added 28 commits September 26, 2026 13:37
This would release the job lock, causing spurious restarts by the dead jobs requeuer.
There is no parameter auto_spec to mock.patch. This is likely a typo.

Running the tests with Python 3.12 give a RuntimeError
```
  File "/usr/local/lib/python3.12/unittest/mock.py", line 1311, in __init__
    _check_spec_arg_typos(kwargs)
  File "/usr/local/lib/python3.12/unittest/mock.py", line 1287, in _check_spec_arg_typos
    raise RuntimeError(
RuntimeError: 'auto_spec' might be a typo.
```
Every time a job is done, even if it is not part of a graph, it runs a
query to look for dependents to enqueue. Storing the dependent uuids in
the "dependencies" field was on purpose to know that we have no further
jobs in the graph and that we can skip the check entirely and have no
overhead in this case.

It looks like an oversight, we can add the missing condition.
In this case, when a module adds a value in context, the tests fail
It is forbidden to commit inside a job, because it releases the job lock
and can cause it to start again, while still being run, by the dead jobs
requeuer. For some use cases, it may actually be legitimate, or at least
be needed in the short term before actual updates in the code.

A new option on the job function, false by default, allow to run the job
in a new transaction, at the cost of an additional connection +
transaction overhead.

Related to OCA#889
False on new databases, True on existing databases.
Should always be False by default on future versions.
As the controller changes env on Job instances.
…ethod

We add the `_subscribe_job_creator` method in `queue.job` which will return True for the cases where we want to subscribe the job creator, False otherwise.
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/
Currently translated at 100.0% (156 of 156 strings)

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/it/
Jobs are always created through sudo() in the Job class, and always
deleted by the cron, never by users.

See discussion on OCA#802 (comment)
Currently translated at 100.0% (156 of 156 strings)

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/it/
- upgrade_code: ir.model.access + ir.rule -> ir.access; registry.clear_cache -> transaction.invalidate_ormcache
- http: patch pe odoo.http.router._set_session_and_dbname (Request._get_session_and_dbname nu mai există)
- controller: PG_CONCURRENCY_ERRORS_TO_RETRY definit local (odoo.service.model l-a eliminat); env.clear() -> env.transaction.clear()
- jobrunner: odoo.modules.db.list_dbs (odoo.service.db eliminat)
- fields: _setup_attrs -> _setup_attrs__; tools.ormcache -> api.ormcache
- JS: widget-ul job_direct_graph portat la Owl 3 (useProps, signal.ref, ActionPlugin)
- view: widget remaining_days -> relative_date

Testat pe Odoo 20 (test20): instalare + teste modul.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhongu
dhongu merged commit 68c6e81 into 20.0 Sep 26, 2026
3 checks passed
@dhongu
dhongu deleted the 20.0-mig-queue_job branch September 26, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.