diff --git a/queue_job_cron/README.rst b/queue_job_cron/README.rst new file mode 100644 index 0000000000..e2be8630ec --- /dev/null +++ b/queue_job_cron/README.rst @@ -0,0 +1,108 @@ +=============================== +Scheduled Actions as Queue Jobs +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c790b0e3494e59c709d57d7dbb0864ac37ce3af23801499f352df7528d5fe072 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github + :target: https://github.com/OCA/queue/tree/18.0/queue_job_cron + :alt: OCA/queue +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_cron + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of queue_job and allows to run an +Odoo cron as a queue job. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +To install this module, you need to: + +1. Just install it. + +Usage +===== + +To use this module, you need to: + +#. Go to a scheduled action, a flag "Run as queue job" will allow you to +run the action as a queue job. You will also allowed to select a channel +of its execution. To configure dedicated channels please refers to +queue_job help: +https://github.com/OCA/queue/blob/12.0/queue_job/README.rst + +Channels can be used to manage sequential jobs and prevent concurrency +accesses. To do that you just have to define a channel per cron limited +to 1 at time. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Cédric Pigeon +- Nguyen Minh Chien +- Tran Quoc duong +- Vo Hong Thien + +Other credits +------------- + +The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp. + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/queue `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/queue_job_cron/__init__.py b/queue_job_cron/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/queue_job_cron/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/queue_job_cron/__manifest__.py b/queue_job_cron/__manifest__.py new file mode 100644 index 0000000000..b996cc4d48 --- /dev/null +++ b/queue_job_cron/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +{ + "name": "Scheduled Actions as Queue Jobs", + "version": "18.0.1.0.0", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/queue", + "license": "AGPL-3", + "category": "Generic Modules", + "depends": ["queue_job"], + "data": ["data/data.xml", "views/ir_cron_view.xml"], + "installable": True, +} diff --git a/queue_job_cron/data/data.xml b/queue_job_cron/data/data.xml new file mode 100644 index 0000000000..0a56d9df32 --- /dev/null +++ b/queue_job_cron/data/data.xml @@ -0,0 +1,12 @@ + + + + ir_cron + + + + + _compute_run_as_queue_job + + + diff --git a/queue_job_cron/i18n/de.po b/queue_job_cron/i18n/de.po new file mode 100644 index 0000000000..4240c6e702 --- /dev/null +++ b/queue_job_cron/i18n/de.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * queue_job_cron +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-07-12 14:43+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__channel_id +msgid "Channel" +msgstr "Kanal" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Run As Queue Job" +msgstr "als Warteschlangen-Job ausführen" + +#. module: queue_job_cron +#: model:ir.model,name:queue_job_cron.model_ir_cron +msgid "Scheduled Actions" +msgstr "Eingeplante Aktionen" + +#. module: queue_job_cron +#: model:ir.model.fields,help:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Specify if this cron should be ran as a queue job" +msgstr "" +"Bitte spezifizieren, ob der Cron-Job als Warteschlangen-Job ausgeführt " +"werden soll." diff --git a/queue_job_cron/i18n/es.po b/queue_job_cron/i18n/es.po new file mode 100644 index 0000000000..7d7f06c148 --- /dev/null +++ b/queue_job_cron/i18n/es.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * queue_job_cron +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-09-03 13:40+0000\n" +"Last-Translator: kikopeiro \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__channel_id +msgid "Channel" +msgstr "Canal" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Run As Queue Job" +msgstr "Ejecutar como trabajo en cola" + +#. module: queue_job_cron +#: model:ir.model,name:queue_job_cron.model_ir_cron +msgid "Scheduled Actions" +msgstr "Acciones planificadas" + +#. module: queue_job_cron +#: model:ir.model.fields,help:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Specify if this cron should be ran as a queue job" +msgstr "" +"Especifica si esta acción planificada deberá ser ejecutada como un trabajo " +"en cola" diff --git a/queue_job_cron/i18n/it.po b/queue_job_cron/i18n/it.po new file mode 100644 index 0000000000..ab9659c1dc --- /dev/null +++ b/queue_job_cron/i18n/it.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * queue_job_cron +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-05 00:26+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__channel_id +msgid "Channel" +msgstr "Canale" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Run As Queue Job" +msgstr "Eseguire come lavoro in coda" + +#. module: queue_job_cron +#: model:ir.model,name:queue_job_cron.model_ir_cron +msgid "Scheduled Actions" +msgstr "Azioni pianificate" + +#. module: queue_job_cron +#: model:ir.model.fields,help:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Specify if this cron should be ran as a queue job" +msgstr "Indica se questo cron deve essere eseguito come un lavoro in coda" diff --git a/queue_job_cron/i18n/queue_job_cron.pot b/queue_job_cron/i18n/queue_job_cron.pot new file mode 100644 index 0000000000..03beb90b6b --- /dev/null +++ b/queue_job_cron/i18n/queue_job_cron.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * queue_job_cron +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__channel_id +msgid "Channel" +msgstr "" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Run As Queue Job" +msgstr "" + +#. module: queue_job_cron +#: model:ir.model,name:queue_job_cron.model_ir_cron +msgid "Scheduled Actions" +msgstr "" + +#. module: queue_job_cron +#: model:ir.model.fields,help:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Specify if this cron should be ran as a queue job" +msgstr "" diff --git a/queue_job_cron/i18n/zh_CN.po b/queue_job_cron/i18n/zh_CN.po new file mode 100644 index 0000000000..166d51606d --- /dev/null +++ b/queue_job_cron/i18n/zh_CN.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * queue_job_cron +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-07-25 17:43+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__channel_id +msgid "Channel" +msgstr "频道" + +#. module: queue_job_cron +#: model:ir.model.fields,field_description:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Run As Queue Job" +msgstr "作为队列作业运行" + +#. module: queue_job_cron +#: model:ir.model,name:queue_job_cron.model_ir_cron +msgid "Scheduled Actions" +msgstr "安排的动作" + +#. module: queue_job_cron +#: model:ir.model.fields,help:queue_job_cron.field_ir_cron__run_as_queue_job +msgid "Specify if this cron should be ran as a queue job" +msgstr "指定此cron是否应作为队列作业运行" diff --git a/queue_job_cron/models/__init__.py b/queue_job_cron/models/__init__.py new file mode 100644 index 0000000000..9115592626 --- /dev/null +++ b/queue_job_cron/models/__init__.py @@ -0,0 +1 @@ +from . import ir_cron diff --git a/queue_job_cron/models/ir_cron.py b/queue_job_cron/models/ir_cron.py new file mode 100644 index 0000000000..bb09ed075e --- /dev/null +++ b/queue_job_cron/models/ir_cron.py @@ -0,0 +1,81 @@ +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) +import logging + +from odoo import api, fields, models + +from odoo.addons.queue_job.job import identity_exact + +_logger = logging.getLogger(__name__) + + +class IrCron(models.Model): + _inherit = "ir.cron" + + no_parallel_queue_job_run = fields.Boolean( + help="Avoid parallel run. " + "If the cron job is already running, the new one will be skipped. " + "By default, odoo never runs the same cron job in parallel. This " + "option is therefore set to True by default when job is run as a " + "queue job.", + default=True, + ) + + run_as_queue_job = fields.Boolean( + help="Specify if this cron should be ran as a queue job" + ) + channel_id = fields.Many2one( + comodel_name="queue.job.channel", + compute="_compute_run_as_queue_job", + readonly=False, + store=True, + string="Channel", + ) + + @api.depends("run_as_queue_job") + def _compute_run_as_queue_job(self): + for cron in self: + if cron.channel_id: + continue + if cron.run_as_queue_job: + cron.channel_id = self.env.ref("queue_job_cron.channel_root_ir_cron").id + else: + cron.channel_id = False + + def _run_job_as_queue_job(self, server_action): + return server_action.run() + + def method_direct_trigger(self): + for cron in self: + if not cron.run_as_queue_job: + super(IrCron, cron).method_direct_trigger() + else: + _cron = cron.with_user(cron.user_id).with_context( + lastcall=cron.lastcall + ) + _cron._delay_run_job_as_queue_job( + server_action=_cron.ir_actions_server_id + ) + return True + + def _callback(self, cron_name, server_action_id, job_id): + cron = self.env["ir.cron"].sudo().browse(job_id) + if cron.run_as_queue_job: + server_action = self.env["ir.actions.server"].browse(server_action_id) + return cron._delay_run_job_as_queue_job(server_action=server_action) + else: + return super()._callback( + cron_name=cron_name, server_action_id=server_action_id, job_id=job_id + ) + + def _delay_run_job_as_queue_job(self, server_action): + self.ensure_one() + identity_key = None + if self.no_parallel_queue_job_run: + identity_key = identity_exact + return self.with_delay( + priority=self.priority, + description=self.name, + channel=self.channel_id.complete_name, + identity_key=identity_key, + )._run_job_as_queue_job(server_action=server_action) diff --git a/queue_job_cron/pyproject.toml b/queue_job_cron/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/queue_job_cron/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/queue_job_cron/readme/CONFIGURATION.md b/queue_job_cron/readme/CONFIGURATION.md new file mode 100644 index 0000000000..1621d5ef75 --- /dev/null +++ b/queue_job_cron/readme/CONFIGURATION.md @@ -0,0 +1,3 @@ +To configure this module, you need to: + +#. Nothing special to do. diff --git a/queue_job_cron/readme/CONTRIBUTORS.md b/queue_job_cron/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..d5861f3ff1 --- /dev/null +++ b/queue_job_cron/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Cédric Pigeon \<\> +- Nguyen Minh Chien \<\> +- Tran Quoc duong \<\> +- Vo Hong Thien \<\> diff --git a/queue_job_cron/readme/CREDITS.md b/queue_job_cron/readme/CREDITS.md new file mode 100644 index 0000000000..83b3ec91f7 --- /dev/null +++ b/queue_job_cron/readme/CREDITS.md @@ -0,0 +1 @@ +The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp. diff --git a/queue_job_cron/readme/DESCRIPTION.md b/queue_job_cron/readme/DESCRIPTION.md new file mode 100644 index 0000000000..fa527e6882 --- /dev/null +++ b/queue_job_cron/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module extends the functionality of queue_job and allows to run an +Odoo cron as a queue job. diff --git a/queue_job_cron/readme/INSTALL.md b/queue_job_cron/readme/INSTALL.md new file mode 100644 index 0000000000..e24aadeae6 --- /dev/null +++ b/queue_job_cron/readme/INSTALL.md @@ -0,0 +1,3 @@ +To install this module, you need to: + +1. Just install it. diff --git a/queue_job_cron/readme/USAGE.md b/queue_job_cron/readme/USAGE.md new file mode 100644 index 0000000000..ef02ba3ba3 --- /dev/null +++ b/queue_job_cron/readme/USAGE.md @@ -0,0 +1,11 @@ +To use this module, you need to: + +#\. Go to a scheduled action, a flag "Run as queue job" will allow you +to run the action as a queue job. You will also allowed to select a +channel of its execution. To configure dedicated channels please refers +to queue_job help: + + +Channels can be used to manage sequential jobs and prevent concurrency +accesses. To do that you just have to define a channel per cron limited +to 1 at time. diff --git a/queue_job_cron/readme/newsfragments/.gitignore b/queue_job_cron/readme/newsfragments/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/queue_job_cron/readme/newsfragments/612.feature b/queue_job_cron/readme/newsfragments/612.feature new file mode 100644 index 0000000000..9c521620a2 --- /dev/null +++ b/queue_job_cron/readme/newsfragments/612.feature @@ -0,0 +1,9 @@ +By default prevent parallel run of the same cron job when run as queue job. + +When a cron job is run by odoo, the odoo runner will prevent parallel run +of the same cron job. Before this change, this was not the case when the +cron job was run as a queue job. A new option is added to the cron job when +run as a queue job to prevent parallel run. This option is set to True by +default. In this way, the behavior is now the same as when the cron job is run +by odoo but you keep the possibility to disable this restriction when run as +a queue job. diff --git a/queue_job_cron/static/description/icon.png b/queue_job_cron/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/queue_job_cron/static/description/icon.png differ diff --git a/queue_job_cron/static/description/index.html b/queue_job_cron/static/description/index.html new file mode 100644 index 0000000000..ab76edda9a --- /dev/null +++ b/queue_job_cron/static/description/index.html @@ -0,0 +1,454 @@ + + + + + +Scheduled Actions as Queue Jobs + + + +
+

Scheduled Actions as Queue Jobs

+ + +

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

+

This module extends the functionality of queue_job and allows to run an +Odoo cron as a queue job.

+

Table of contents

+ +
+

Installation

+

To install this module, you need to:

+
    +
  1. Just install it.
  2. +
+
+
+

Usage

+

To use this module, you need to:

+

#. Go to a scheduled action, a flag “Run as queue job” will allow you to +run the action as a queue job. You will also allowed to select a channel +of its execution. To configure dedicated channels please refers to +queue_job help: +https://github.com/OCA/queue/blob/12.0/queue_job/README.rst

+

Channels can be used to manage sequential jobs and prevent concurrency +accesses. To do that you just have to define a channel per cron limited +to 1 at time.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp.

+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/queue project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/queue_job_cron/tests/__init__.py b/queue_job_cron/tests/__init__.py new file mode 100644 index 0000000000..383bde64ef --- /dev/null +++ b/queue_job_cron/tests/__init__.py @@ -0,0 +1 @@ +from . import test_queue_job_cron diff --git a/queue_job_cron/tests/test_queue_job_cron.py b/queue_job_cron/tests/test_queue_job_cron.py new file mode 100644 index 0000000000..d3cc18d636 --- /dev/null +++ b/queue_job_cron/tests/test_queue_job_cron.py @@ -0,0 +1,60 @@ +# Copyright 2019 ACSONE SA/NV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo.tests.common import TransactionCase + + +class TestQueueJobCron(TransactionCase): + def setUp(self): + super().setUp() + + def test_queue_job_cron(self): + QueueJob = self.env["queue.job"] + default_channel = self.env.ref("queue_job_cron.channel_root_ir_cron") + cron = self.env.ref("queue_job.ir_cron_autovacuum_queue_jobs") + self.assertFalse(cron.run_as_queue_job) + + cron.method_direct_trigger() + nb_jobs = QueueJob.search_count([("name", "=", cron.name)]) + self.assertEqual(nb_jobs, 0) + + cron.write({"run_as_queue_job": True, "channel_id": default_channel.id}) + + cron.method_direct_trigger() + qjob = QueueJob.search([("name", "=", cron.name)]) + + self.assertTrue(qjob) + self.assertEqual(qjob.name, cron.name) + self.assertEqual(qjob.priority, cron.priority) + self.assertEqual(qjob.user_id, cron.user_id) + self.assertEqual(qjob.channel, cron.channel_id.complete_name) + + def test_queue_job_cron_depends(self): + cron = self.env.ref("queue_job.ir_cron_autovacuum_queue_jobs") + default_channel = self.env.ref("queue_job_cron.channel_root_ir_cron") + self.assertFalse(cron.run_as_queue_job) + cron.write({"run_as_queue_job": True}) + self.assertEqual(cron.channel_id.id, default_channel.id) + + def test_queue_job_cron_run(self): + cron = self.env.ref("queue_job.ir_cron_autovacuum_queue_jobs") + IrCron = self.env["ir.cron"] + IrCron._run_job_as_queue_job(server_action=cron.ir_actions_server_id) + + def test_queue_job_no_parallelism(self): + cron = self.env.ref("queue_job.ir_cron_autovacuum_queue_jobs") + default_channel = self.env.ref("queue_job_cron.channel_root_ir_cron") + cron.write( + { + "no_parallel_queue_job_run": True, + "run_as_queue_job": True, + "channel_id": default_channel.id, + } + ) + cron.method_direct_trigger() + cron.method_direct_trigger() + nb_jobs = self.env["queue.job"].search_count([("name", "=", cron.name)]) + self.assertEqual(nb_jobs, 1) + cron.no_parallel_queue_job_run = False + cron.method_direct_trigger() + nb_jobs = self.env["queue.job"].search_count([("name", "=", cron.name)]) + self.assertEqual(nb_jobs, 2) diff --git a/queue_job_cron/views/ir_cron_view.xml b/queue_job_cron/views/ir_cron_view.xml new file mode 100644 index 0000000000..0a9a64d275 --- /dev/null +++ b/queue_job_cron/views/ir_cron_view.xml @@ -0,0 +1,42 @@ + + + + ir.cron.view.form (queue_job_cron) + ir.cron + + + + + + + + + + + ir.cron.view.tree (queue_job_cron) + ir.cron + + + + + + + + + ir.cron.view.search (queue_job_cron) + ir.cron + + + + + + + +