From 72d9cc8f62cf6853f351a0c610d37d74c876b905 Mon Sep 17 00:00:00 2001 From: Adam Heinz Date: Mon, 7 Jul 2025 09:22:18 -0400 Subject: [PATCH 1/4] [FIX] queue_job: prevent conflict w/ TestOverrides:test_creates This prevents TestOverrides.test_creates from failing in the Odoo `base` module due to sentinel protections taking effect even for local create invocations. --- queue_job/models/queue_job.py | 7 +---- .../tests/test_queue_job_protected_write.py | 26 ++++++++++++++++--- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/queue_job/models/queue_job.py b/queue_job/models/queue_job.py index 465d5fd1d7..98c5858203 100644 --- a/queue_job/models/queue_job.py +++ b/queue_job/models/queue_job.py @@ -235,13 +235,8 @@ def _compute_graph_jobs_count(self): record.graph_jobs_count = count_per_graph_uuid.get(record.graph_uuid) or 0 @api.model_create_multi + @api.private def create(self, vals_list): - if self.env.context.get("_job_edit_sentinel") is not self.EDIT_SENTINEL: - # Prevent to create a queue.job record "raw" from RPC. - # ``with_delay()`` must be used. - raise exceptions.AccessError( - _("Queue jobs must be created by calling 'with_delay()'.") - ) return super( QueueJob, self.with_context(mail_create_nolog=True, mail_create_nosubscribe=True), diff --git a/queue_job/tests/test_queue_job_protected_write.py b/queue_job/tests/test_queue_job_protected_write.py index 018b3f23f4..eadb16ab9c 100644 --- a/queue_job/tests/test_queue_job_protected_write.py +++ b/queue_job/tests/test_queue_job_protected_write.py @@ -3,15 +3,33 @@ from odoo import exceptions from odoo.tests import common +from odoo.tools import mute_logger -class TestJobWriteProtected(common.TransactionCase): +class TestJobCreatePrivate(common.HttpCase): def test_create_error(self): - with self.assertRaises(exceptions.AccessError): - self.env["queue.job"].create( - {"uuid": "test", "model_name": "res.partner", "method_name": "write"} + self.authenticate("admin", "admin") + with self.assertRaises(common.JsonRpcException) as cm, mute_logger("odoo.http"): + self.make_jsonrpc_request( + "/web/dataset/call_kw", + params={ + "model": "queue.job", + "method": "create", + "args": [], + "kwargs": { + "method_name": "write", + "model_name": "res.partner", + "uuid": "test", + }, + }, + headers={ + "Cookie": f"session_id={self.session.sid};", + }, ) + self.assertEqual("odoo.exceptions.AccessError", str(cm.exception)) + +class TestJobWriteProtected(common.TransactionCase): def test_write_protected_field_error(self): job_ = self.env["res.partner"].with_delay().create({"name": "test"}) db_job = job_.db_record() From 5a980c8d1410e3c06ee1708b23287e78e66df5f6 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Thu, 10 Jul 2025 11:38:51 +0000 Subject: [PATCH 2/4] [UPD] Update queue_job.pot --- queue_job/i18n/queue_job.pot | 6 ------ 1 file changed, 6 deletions(-) diff --git a/queue_job/i18n/queue_job.pot b/queue_job/i18n/queue_job.pot index 3e523934ed..5663e5328b 100644 --- a/queue_job/i18n/queue_job.pot +++ b/queue_job/i18n/queue_job.pot @@ -645,12 +645,6 @@ msgstr "" msgid "Queue Job" msgstr "" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "" - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records msgid "Record(s)" From 5b7cedde517416f69ebac39022bd9813a11555ad Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 10 Jul 2025 11:40:51 +0000 Subject: [PATCH 3/4] [BOT] post-merge updates --- README.md | 2 +- queue_job/README.rst | 2 +- queue_job/__manifest__.py | 2 +- queue_job/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ac07d5520..4e4e7dcba3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Available addons addon | version | maintainers | summary --- | --- | --- | --- [base_import_async](base_import_async/) | 18.0.1.0.0 | | Import CSV files in the background -[queue_job](queue_job/) | 18.0.1.7.0 | guewen | Job Queue +[queue_job](queue_job/) | 18.0.1.7.1 | guewen | Job Queue [queue_job_batch](queue_job_batch/) | 18.0.1.0.0 | | Job Queue Batch [queue_job_cron](queue_job_cron/) | 18.0.1.1.1 | | Scheduled Actions as Queue Jobs [queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 18.0.1.0.0 | ivantodorovich | Run jobs without a dedicated JobRunner diff --git a/queue_job/README.rst b/queue_job/README.rst index 0ac718620f..14b0de00af 100644 --- a/queue_job/README.rst +++ b/queue_job/README.rst @@ -11,7 +11,7 @@ Job Queue !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1546ea44a63ecafe2dcee75567a04b4df20b00c51c1494a42056b388ddec15ad + !! source digest: sha256:93bf08eab226d25a64e06bcf90f0fb7f40f81ac6c18f9d902b0cd7e9be75ebef !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index 4ef73c0421..1e6bee8736 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Job Queue", - "version": "18.0.1.7.0", + "version": "18.0.1.7.1", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "LGPL-3", diff --git a/queue_job/static/description/index.html b/queue_job/static/description/index.html index cd92a52e19..604c12febb 100644 --- a/queue_job/static/description/index.html +++ b/queue_job/static/description/index.html @@ -372,7 +372,7 @@

Job Queue

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:1546ea44a63ecafe2dcee75567a04b4df20b00c51c1494a42056b388ddec15ad +!! source digest: sha256:93bf08eab226d25a64e06bcf90f0fb7f40f81ac6c18f9d902b0cd7e9be75ebef !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Mature License: LGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This addon adds an integrated Job Queue to Odoo.

From edaef68659c7f91dae60a906869f9ed8186da52e Mon Sep 17 00:00:00 2001 From: Weblate Date: Thu, 10 Jul 2025 11:41:00 +0000 Subject: [PATCH 4/4] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-18.0/queue-18.0-queue_job Translate-URL: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job/ --- queue_job/i18n/de.po | 6 ------ queue_job/i18n/es.po | 9 +++------ queue_job/i18n/it.po | 9 +++------ queue_job/i18n/tr.po | 9 +++------ queue_job/i18n/tr_TR.po | 6 ------ queue_job/i18n/zh_CN.po | 9 +++------ 6 files changed, 12 insertions(+), 36 deletions(-) diff --git a/queue_job/i18n/de.po b/queue_job/i18n/de.po index 7db5bc7ecf..94c9f01c6c 100644 --- a/queue_job/i18n/de.po +++ b/queue_job/i18n/de.po @@ -655,12 +655,6 @@ msgstr "Warteschlange" msgid "Queue Job" msgstr "Job einreihen" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "" - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records #, fuzzy diff --git a/queue_job/i18n/es.po b/queue_job/i18n/es.po index a338ecafd4..cc87485527 100644 --- a/queue_job/i18n/es.po +++ b/queue_job/i18n/es.po @@ -665,12 +665,6 @@ msgstr "Cola" msgid "Queue Job" msgstr "Cola de trabajos" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "Los trabajos en cola deben crearse llamando a 'with_delay()'." - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records msgid "Record(s)" @@ -941,6 +935,9 @@ msgstr "Asistente para volver a poner en cola una selección de trabajos" msgid "Worker Pid" msgstr "Pid del trabajador" +#~ msgid "Queue jobs must be created by calling 'with_delay()'." +#~ msgstr "Los trabajos en cola deben crearse llamando a 'with_delay()'." + #~ msgid "SMS Delivery error" #~ msgstr "Error de entrega del SMS" diff --git a/queue_job/i18n/it.po b/queue_job/i18n/it.po index 91e3a3cdf6..99b6d2ee82 100644 --- a/queue_job/i18n/it.po +++ b/queue_job/i18n/it.po @@ -662,12 +662,6 @@ msgstr "Coda" msgid "Queue Job" msgstr "Lavoro in coda" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "Il lavoro in coda deve essere creato chiamando 'with_delay()'." - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records msgid "Record(s)" @@ -940,6 +934,9 @@ msgstr "Procedura guidata per riaccodare una selezione di lavori" msgid "Worker Pid" msgstr "PID worker" +#~ msgid "Queue jobs must be created by calling 'with_delay()'." +#~ msgstr "Il lavoro in coda deve essere creato chiamando 'with_delay()'." + #~ msgid "SMS Delivery error" #~ msgstr "Errore consegna SMS" diff --git a/queue_job/i18n/tr.po b/queue_job/i18n/tr.po index 6083174d22..f60188c0df 100644 --- a/queue_job/i18n/tr.po +++ b/queue_job/i18n/tr.po @@ -662,12 +662,6 @@ msgstr "Kuyruk" msgid "Queue Job" msgstr "Kuyruk İşi" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "Kuyruk işleri 'with_delay()' çağrılarak oluşturulmalıdır." - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records msgid "Record(s)" @@ -940,5 +934,8 @@ msgstr "Seçilen işleri yeniden sıraya almak için sihirbaz" msgid "Worker Pid" msgstr "Çalışan Pid" +#~ msgid "Queue jobs must be created by calling 'with_delay()'." +#~ msgstr "Kuyruk işleri 'with_delay()' çağrılarak oluşturulmalıdır." + #~ msgid "SMS Delivery error" #~ msgstr "SMS Teslim hatası" diff --git a/queue_job/i18n/tr_TR.po b/queue_job/i18n/tr_TR.po index 222b04e696..cc571fbd2d 100644 --- a/queue_job/i18n/tr_TR.po +++ b/queue_job/i18n/tr_TR.po @@ -650,12 +650,6 @@ msgstr "" msgid "Queue Job" msgstr "" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "" - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records msgid "Record(s)" diff --git a/queue_job/i18n/zh_CN.po b/queue_job/i18n/zh_CN.po index 74486e8ade..da298db9c4 100644 --- a/queue_job/i18n/zh_CN.po +++ b/queue_job/i18n/zh_CN.po @@ -660,12 +660,6 @@ msgstr "队列" msgid "Queue Job" msgstr "队列作业" -#. module: queue_job -#. odoo-python -#: code:addons/queue_job/models/queue_job.py:0 -msgid "Queue jobs must be created by calling 'with_delay()'." -msgstr "队列任务必须通过调用'with_delay()'方法来创建。" - #. module: queue_job #: model:ir.model.fields,field_description:queue_job.field_queue_job__records msgid "Record(s)" @@ -930,6 +924,9 @@ msgstr "重新排队向导所选的作业" msgid "Worker Pid" msgstr "工作进程PID" +#~ msgid "Queue jobs must be created by calling 'with_delay()'." +#~ msgstr "队列任务必须通过调用'with_delay()'方法来创建。" + #~ msgid "SMS Delivery error" #~ msgstr "短信传递错误"