From 4e96e71ae0a2b96e19d5d6e272369046fa133d6b Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 21 Sep 2026 21:55:23 +0200 Subject: [PATCH 1/4] oca-port: blacklist PR(s) 840, 913, 924, 969 for queue_job --- .oca/oca-port/blacklist/queue_job.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.oca/oca-port/blacklist/queue_job.json b/.oca/oca-port/blacklist/queue_job.json index f9a3e546c8..e05ca4951b 100644 --- a/.oca/oca-port/blacklist/queue_job.json +++ b/.oca/oca-port/blacklist/queue_job.json @@ -3,6 +3,10 @@ "OCA/queue#440": "The changes from this PR are already present in the current source code.", "OCA/queue#511": "The changes from this PR are already present in the current source code.", "OCA/queue#537": "The changes from this PR are already present in the current source code.", - "OCA/queue#728": "The changes from this PR are already present in the current source code." + "OCA/queue#728": "The changes from this PR are already present in the current source code.", + "OCA/queue#840": "Migration to 19", + "OCA/queue#913": "Port to 19", + "OCA/queue#924": "Specific to 19", + "OCA/queue#969": "Already done" } } From 92c1846b86a4b7b90b5de7933ae7fdf7a5f62c3e Mon Sep 17 00:00:00 2001 From: Fernando Date: Sat, 16 May 2026 22:12:44 -0400 Subject: [PATCH 2/4] [FIX] queue_job: add openupgradelib to external_dependencies The module uses openupgradelib in migration scripts but it was not declared in external_dependencies, causing installation failures when openupgradelib is not already installed. Fixes #809 --- queue_job/__manifest__.py | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index 41fb0bc6bf..e8edb6a12b 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -8,7 +8,7 @@ "license": "LGPL-3", "category": "Generic Modules", "depends": ["mail", "base_sparse_field", "web"], - "external_dependencies": {"python": ["requests"]}, + "external_dependencies": {"python": ["requests", "openupgradelib"]}, "data": [ "security/security.xml", "security/ir.model.access.csv", diff --git a/requirements.txt b/requirements.txt index b4d39fb9e0..12783be9a2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ # generated from manifests external_dependencies +openupgradelib requests From 0ea01182d77a5823c4a38ed3f724111bceee54f7 Mon Sep 17 00:00:00 2001 From: Danny Adair Date: Wed, 22 Apr 2026 15:54:09 +1200 Subject: [PATCH 3/4] [FIX] queue_job: repoint default_env to SUPERUSER in runjob runjob is declared auth="none", so _auth_method_none pins request.env and transaction.default_env to a uid=None env. `env = http.request.env( user=SUPERUSER_ID)` only creates a local superuser env, leaving the default_env as uid=None. Any flush that goes through Transaction.flush() -> default_env.flush_all() then recomputes stored fields as uid=None and fails on anything dereferencing self.env.user. `http.request.update_env(user=SUPERUSER_ID)` additionally sets transaction.default_env to the superuser env. Closes #922 --- queue_job/controllers/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/queue_job/controllers/main.py b/queue_job/controllers/main.py index 91cda8ca3b..1e587f3484 100644 --- a/queue_job/controllers/main.py +++ b/queue_job/controllers/main.py @@ -216,7 +216,8 @@ def _get_failure_values(cls, job, traceback_txt, orig_exception): ) def runjob(self, db, job_uuid, **kw): http.request.session.db = db - env = http.request.env(user=SUPERUSER_ID) + http.request.update_env(user=SUPERUSER_ID) + env = http.request.env job = self._acquire_job(env, job_uuid) if not job: return "" From d9dcf24f5b0696626ece0b3afbaadfaad3c727e7 Mon Sep 17 00:00:00 2001 From: "Danny W. Adair" Date: Wed, 1 Jul 2026 11:13:47 +0000 Subject: [PATCH 4/4] [ADD] queue_job: HttpCase regression tests for /queue_job/runjob Adds test_run_job_controller_http.py covering #922: - test_runjob_pins_default_env_to_superuser asserts that when _acquire_job is entered, env.transaction.default_env.uid is SUPERUSER_ID -- the state a job would inherit at perform time. - test_runjob_without_updating_default_env_leaves_uid_none patches Request.update_env to a no-op and verifies default_env.uid stays None, isolating default_env repointing as the load-bearing behavior of runjob. Tests use HttpCase so _auth_method_none, session handling, and update_env run for real. _acquire_job is patched to return None so the endpoint exits cleanly without performing DB work (its internal commit is forbidden inside tests). --- queue_job/static/description/index.html | 2 +- queue_job/tests/__init__.py | 1 + .../tests/test_run_job_controller_http.py | 85 +++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 queue_job/tests/test_run_job_controller_http.py diff --git a/queue_job/static/description/index.html b/queue_job/static/description/index.html index 70e81392bc..80202ab5de 100644 --- a/queue_job/static/description/index.html +++ b/queue_job/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Job Queue