Skip to content

Commit 88a2993

Browse files
committed
[MIG] queue_job_cron: Migration to 19.0
1 parent 52acb9d commit 88a2993

5 files changed

Lines changed: 41 additions & 33 deletions

File tree

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ exclude: |
33
# NOT INSTALLABLE ADDONS
44
^base_import_async/|
55
^queue_job_batch/|
6-
^queue_job_cron/|
76
^queue_job_cron_jobrunner/|
87
^queue_job_subscribe/|
98
^test_queue_job_batch/|

queue_job_cron/README.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Scheduled Actions as Queue Jobs
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
24-
:target: https://github.com/OCA/queue/tree/18.0/queue_job_cron
24+
:target: https://github.com/OCA/queue/tree/19.0/queue_job_cron
2525
:alt: OCA/queue
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_cron
27+
:target: https://translation.odoo-community.org/projects/queue-19-0/queue-19-0-queue_job_cron
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -71,25 +71,25 @@ Changelog
7171
Features
7272
~~~~~~~~
7373

74-
- By default prevent parallel run of the same cron job when run as queue
75-
job.
74+
- By default prevent parallel run of the same cron job when run as
75+
queue job.
7676

77-
When a cron job is run by odoo, the odoo runner will prevent parallel
78-
run of the same cron job. Before this change, this was not the case
79-
when the cron job was run as a queue job. A new option is added to the
80-
cron job when run as a queue job to prevent parallel run. This option
81-
is set to True by default. In this way, the behavior is now the same
82-
as when the cron job is run by odoo but you keep the possibility to
83-
disable this restriction when run as a queue job.
84-
(`#612 <https://github.com/OCA/queue/issues/612>`__)
77+
When a cron job is run by odoo, the odoo runner will prevent parallel
78+
run of the same cron job. Before this change, this was not the case
79+
when the cron job was run as a queue job. A new option is added to
80+
the cron job when run as a queue job to prevent parallel run. This
81+
option is set to True by default. In this way, the behavior is now
82+
the same as when the cron job is run by odoo but you keep the
83+
possibility to disable this restriction when run as a queue job.
84+
(`#612 <https://github.com/OCA/queue/issues/612>`__)
8585

8686
Bug Tracker
8787
===========
8888

8989
Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_.
9090
In case of trouble, please check there if your issue has already been reported.
9191
If you spotted it first, help us to smash it by providing a detailed and welcomed
92-
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20queue_job_cron%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
92+
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20queue_job_cron%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
9393

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

@@ -104,10 +104,10 @@ Authors
104104
Contributors
105105
------------
106106

107-
- Cédric Pigeon <cedric.pigeon@acsone.eu>
108-
- Nguyen Minh Chien <chien@trobz.com>
109-
- Tran Quoc duong <duongtq@trobz.com>
110-
- Vo Hong Thien <thienvh@trobz.com>
107+
- Cédric Pigeon <cedric.pigeon@acsone.eu>
108+
- Nguyen Minh Chien <chien@trobz.com>
109+
- Tran Quoc duong <duongtq@trobz.com>
110+
- Vo Hong Thien <thienvh@trobz.com>
111111

112112
Other credits
113113
-------------
@@ -128,6 +128,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
128128
mission is to support the collaborative development of Odoo features and
129129
promote its widespread use.
130130

131-
This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/18.0/queue_job_cron>`_ project on GitHub.
131+
This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/19.0/queue_job_cron>`_ project on GitHub.
132132

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

queue_job_cron/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
{
55
"name": "Scheduled Actions as Queue Jobs",
6-
"version": "18.0.1.1.1",
6+
"version": "19.0.1.0.0",
77
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
88
"website": "https://github.com/OCA/queue",
99
"license": "AGPL-3",
1010
"category": "Generic Modules",
1111
"depends": ["queue_job"],
1212
"data": ["data/data.xml", "views/ir_cron_view.xml"],
13-
"installable": False,
13+
"installable": True,
1414
}

queue_job_cron/static/description/index.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Scheduled Actions as Queue Jobs</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:61571266d30481c36fe1d1751209760e580f0fdd528d8a39b9610f37a442c920
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/queue/tree/18.0/queue_job_cron"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_cron"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/queue&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/queue/tree/19.0/queue_job_cron"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/queue-19-0/queue-19-0-queue_job_cron"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/queue&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>This module extends the functionality of queue_job and allows to run an
379379
Odoo cron as a queue job.</p>
380380
<p><strong>Table of contents</strong></p>
@@ -425,15 +425,15 @@ <h3><a class="toc-backref" href="#toc-entry-4">18.0.1.1.0 (2025-01-16)</a></h3>
425425
<div class="section" id="features">
426426
<h4><a class="toc-backref" href="#toc-entry-5">Features</a></h4>
427427
<ul>
428-
<li><p class="first">By default prevent parallel run of the same cron job when run as queue
429-
job.</p>
428+
<li><p class="first">By default prevent parallel run of the same cron job when run as
429+
queue job.</p>
430430
<p>When a cron job is run by odoo, the odoo runner will prevent parallel
431431
run of the same cron job. Before this change, this was not the case
432-
when the cron job was run as a queue job. A new option is added to the
433-
cron job when run as a queue job to prevent parallel run. This option
434-
is set to True by default. In this way, the behavior is now the same
435-
as when the cron job is run by odoo but you keep the possibility to
436-
disable this restriction when run as a queue job.
432+
when the cron job was run as a queue job. A new option is added to
433+
the cron job when run as a queue job to prevent parallel run. This
434+
option is set to True by default. In this way, the behavior is now
435+
the same as when the cron job is run by odoo but you keep the
436+
possibility to disable this restriction when run as a queue job.
437437
(<a class="reference external" href="https://github.com/OCA/queue/issues/612">#612</a>)</p>
438438
</li>
439439
</ul>
@@ -445,7 +445,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h2>
445445
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/queue/issues">GitHub Issues</a>.
446446
In case of trouble, please check there if your issue has already been reported.
447447
If you spotted it first, help us to smash it by providing a detailed and welcomed
448-
<a class="reference external" href="https://github.com/OCA/queue/issues/new?body=module:%20queue_job_cron%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
448+
<a class="reference external" href="https://github.com/OCA/queue/issues/new?body=module:%20queue_job_cron%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
449449
<p>Do not contact contributors directly about support or help with technical issues.</p>
450450
</div>
451451
<div class="section" id="credits">
@@ -479,7 +479,7 @@ <h3><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h3>
479479
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
480480
mission is to support the collaborative development of Odoo features and
481481
promote its widespread use.</p>
482-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/queue/tree/18.0/queue_job_cron">OCA/queue</a> project on GitHub.</p>
482+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/queue/tree/19.0/queue_job_cron">OCA/queue</a> project on GitHub.</p>
483483
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
484484
</div>
485485
</div>

queue_job_cron/tests/test_queue_job_cron.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
from unittest.mock import patch
4+
35
from odoo.tests.common import TransactionCase
46

57

@@ -73,7 +75,14 @@ def test_queue_job_cron_callback(self):
7375
}
7476
)
7577
cron = self.env.ref("queue_job.ir_cron_autovacuum_queue_jobs")
76-
cron._callback("Test queue job cron", action.id)
78+
# In Odoo 19 the base `_callback` commits/rolls back the cursor, which
79+
# is forbidden inside a TransactionCase; bypass that on the
80+
# super-delegating path so we can still assert it ran the action.
81+
with (
82+
patch.object(self.env.cr, "commit"),
83+
patch.object(self.env.cr, "rollback"),
84+
):
85+
cron._callback("Test queue job cron", action.id)
7786
nb_partners_after_cron = self.env["res.partner"].search_count([])
7887
self.assertEqual(nb_partners_after_cron, nb_partners + 1)
7988
cron.write({"run_as_queue_job": True})

0 commit comments

Comments
 (0)