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 |
| Job Queue
+[queue_job](queue_job/) | 18.0.1.7.1 |
| 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 |
| 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/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/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)"
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 "短信传递错误"
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/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 @@
This addon adds an integrated Job Queue to Odoo.
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()