Skip to content

Commit e0601f6

Browse files
committed
Merge PR #744 into 18.0
Signed-off-by simahawk
2 parents 0351648 + 752c650 commit e0601f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3792
-0
lines changed

queue_job_batch/README.rst

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
===============
2+
Job Queue Batch
3+
===============
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:7eceb569ec18547f2b64717734aecc66c0db338d51e13d6f1324785c6c2f8407
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
20+
:target: https://github.com/OCA/queue/tree/18.0/queue_job_batch
21+
:alt: OCA/queue
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_batch
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This addon adds an a grouper for queue jobs.
32+
33+
It allows to show your jobs in a batched form in order to know better
34+
the results.
35+
36+
Example:
37+
38+
.. code:: python
39+
40+
from odoo import models, fields, api
41+
42+
43+
class MyModel(models.Model):
44+
_name = 'my.model'
45+
46+
def my_method(self, a, k=None):
47+
_logger.info('executed with a: %s and k: %s', a, k)
48+
49+
50+
class MyOtherModel(models.Model):
51+
_name = 'my.other.model'
52+
53+
@api.multi
54+
def button_do_stuff(self):
55+
batch = self.env['queue.job.batch'].get_new_batch('Group')
56+
model = self.env['my.model'].with_context(job_batch=batch)
57+
for i in range(1, 100):
58+
model.with_delay().my_method('a', k=i)
59+
60+
In the snippet of code above, when we call ``button_do_stuff``, 100 jobs
61+
capturing the method and arguments will be postponed. It will be
62+
executed as soon as the Jobrunner has a free bucket, which can be
63+
instantaneous if no other job is running.
64+
65+
Once all the jobs have finished, the grouper will be marked as finished.
66+
67+
**Table of contents**
68+
69+
.. contents::
70+
:local:
71+
72+
Usage
73+
=====
74+
75+
You can manage your batch jobs from the Systray. A new button will be
76+
shown with your currently executing job batches and the recently
77+
finished job groups.
78+
79+
Bug Tracker
80+
===========
81+
82+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_.
83+
In case of trouble, please check there if your issue has already been reported.
84+
If you spotted it first, help us to smash it by providing a detailed and welcomed
85+
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20queue_job_batch%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
86+
87+
Do not contact contributors directly about support or help with technical issues.
88+
89+
Credits
90+
=======
91+
92+
Authors
93+
-------
94+
95+
* Creu Blanca
96+
97+
Contributors
98+
------------
99+
100+
- Enric Tobella <[email protected]>
101+
102+
- `Trobz <https://trobz.com>`__:
103+
104+
- Hoang Diep <[email protected]>
105+
106+
- `ForgeFlow <https://forgeflow.com>`__:
107+
108+
- Lois Rilo <[email protected]>
109+
- Jasmin Solanki <[email protected]>
110+
111+
- `Camptocamp <https://camptocamp.com>`__:
112+
113+
- Maksym Yankin <[email protected]>
114+
- Iván Todorovich <[email protected]>
115+
116+
Other credits
117+
-------------
118+
119+
The migration of this module from 12.0 to 14.0 was financially supported
120+
by Camptocamp
121+
122+
Maintainers
123+
-----------
124+
125+
This module is maintained by the OCA.
126+
127+
.. image:: https://odoo-community.org/logo.png
128+
:alt: Odoo Community Association
129+
:target: https://odoo-community.org
130+
131+
OCA, or the Odoo Community Association, is a nonprofit organization whose
132+
mission is to support the collaborative development of Odoo features and
133+
promote its widespread use.
134+
135+
This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/18.0/queue_job_batch>`_ project on GitHub.
136+
137+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

queue_job_batch/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import controllers
2+
from . import models

queue_job_batch/__manifest__.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2019 Creu Blanca
2+
# Copyright 2023 ForgeFlow S.L. (http://www.forgeflow.com)
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
4+
5+
{
6+
"name": "Job Queue Batch",
7+
"version": "18.0.1.0.0",
8+
"author": "Creu Blanca,Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/queue",
10+
"license": "AGPL-3",
11+
"category": "Generic Modules",
12+
"depends": [
13+
"queue_job",
14+
],
15+
"data": [
16+
# data
17+
"data/queue_job_channel_data.xml",
18+
"data/queue_job_function_data.xml",
19+
# security
20+
"security/security.xml",
21+
"security/ir.model.access.csv",
22+
# views
23+
"views/queue_job_views.xml",
24+
"views/queue_job_batch_views.xml",
25+
],
26+
"assets": {
27+
"web.assets_backend": [
28+
"queue_job_batch/static/src/**/*.js",
29+
"queue_job_batch/static/src/**/*.xml",
30+
"queue_job_batch/static/src/**/*.scss",
31+
],
32+
},
33+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import webclient
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 Camptocamp SA (https://www.camptocamp.com).
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo.http import request
5+
6+
from odoo.addons.mail.controllers.webclient import WebclientController
7+
8+
9+
class WebClient(WebclientController):
10+
def _process_request_for_internal_user(self, store, **kwargs):
11+
res = super()._process_request_for_internal_user(store, **kwargs)
12+
if kwargs.get("systray_get_queue_job_batches"):
13+
# sudo: bus.bus: reading non-sensitive last id
14+
bus_last_id = request.env["bus.bus"].sudo()._bus_last_id()
15+
batches = request.env.user._get_queue_job_batches()
16+
store.add(batches)
17+
store.add(
18+
{
19+
"queueJobBatchCounter": len(batches),
20+
"queueJobBatchCounterBusId": bus_last_id,
21+
}
22+
)
23+
return res
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<odoo noupdate="1">
2+
<record model="queue.job.channel" id="channel_queue_job_batch">
3+
<field name="name">queue.job.batch</field>
4+
<field name="parent_id" ref="queue_job.channel_root" />
5+
</record>
6+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<odoo noupdate="1">
2+
<record id="job_function_queue_job_check_state" model="queue.job.function">
3+
<field name="model_id" ref="queue_job_batch.model_queue_job_batch" />
4+
<field name="channel_id" ref="queue_job_batch.channel_queue_job_batch" />
5+
<field name="method">check_state</field>
6+
</record>
7+
</odoo>

0 commit comments

Comments
 (0)