Repository
OCA/queue · module folder · Try on Runboat
Module version
1.0.0
Category
Generic Modules
Folder size
0.1 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/queue
Last tracking update
2026-08-07 09:06:27
Authors
Odoo Community Association (OCA), Creu Blanca
Maintainers
Odoo Community Association (OCA), Creu Blanca
Committers
Stéphane Bidoul
Odoo dependencies
OCA/queue:
odoo/odoo:
- web
- bus
Python dependencies
openupgradelib, requests
System dependencies
None
Required by
test_queue_job_batch
Description
This addon adds an a grouper for queue jobs.

It allows to show your jobs in a batched form in order to know better
the results.

Example:

``` python
from odoo import models, fields, api


class MyModel(models.Model):
    _name = 'my.model'

    def my_method(self, a, k=None):
        _logger.info('executed with a: %s and k: %s', a, k)


class MyOtherModel(models.Model):
    _name = 'my.other.model'

    @api.multi
    def button_do_stuff(self):
        batch = self.env['queue.job.batch'].get_new_batch('Group')
        model = self.env['my.model'].with_context(job_batch=batch)
        for i in range(1, 100):
            model.with_delay().my_method('a', k=i)
```

In the snippet of code above, when we call `button_do_stuff`, 100 jobs
capturing the method and arguments will be postponed. It will be
executed as soon as the Jobrunner has a free bucket, which can be
instantaneous if no other job is running.

Once all the jobs have finished, the grouper will be marked as finished.

Code Analysis

Views touched (5)
XML IDNameModelTypeStatus
view_queue_job_batch_form queue.job.batch.form queue.job.batch form New
view_queue_job_batch_search queue.job.batch.search queue.job.batch search New
view_queue_job_batch_tree queue.job.batch.tree queue.job.batch list New
view_queue_job_form queue.job.form queue.job form Inherits queue_job.view_queue_job_form
view_queue_job_search queue.job.search queue.job search Inherits queue_job.view_queue_job_search
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (3)

New fields (1)
  • job_batch_id Many2one → queue.job.batch
    args: 'queue.job.batch'
Public methods (2)
  • create(self, vals_list)
    @api.model_create_multi
  • write(self, vals)

New fields (11)
  • company_id Many2one → res.company
    readonly=True args: 'res.company'
  • completeness Float
    compute='_compute_job_count'
  • failed_job_count Float
    compute='_compute_job_count'
  • failed_percentage Float
    compute='_compute_job_count'
  • finished_job_count Float
    compute='_compute_job_count'
  • is_read Boolean
  • job_count Integer
    compute='_compute_job_count'
  • job_ids One2many → queue.job
    inverse_name='job_batch_id' readonly=True args: 'queue.job'
  • name Char
    readonly=True required=True tracking=True
  • state Selection
    default='pending' readonly=True required=True tracking=True args: [('pending', 'Pending'), ('enqueued', 'Enqueued'), ('progress', 'In Progress'), ('finished', 'Finished')]
  • user_id Many2one → res.users
    readonly=True required=True tracking=True args: 'res.users'
Public methods (3)
  • check_state(self)
  • get_new_batch(self, name, **kwargs)
    @api.model
  • set_read(self)

New fields (0)

No new fields.

Public methods (0)

No public methods.

Loading…

Loading…

Loading…

Loading…

Loading…