[16.0] Module queue_job_chatter
Is your feature request related to a problem? If so, please provide clear and concise description of what the problem is. One off challenges using the job queue is to be able to show for a related model that a task is running in job queue. The user has to wait if something went all right or wrong to be able to access the result.
Describe the solution you'd like A clear and concise description of what you want to happen. If we queue a job after pressing a button we could have in the form view of the related model a widget to show the queue task as a progress of a enqueued or running task. Maybe using the activities to show enqueue tasks.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context about the feature request here.
I just developed a module queue_job_chatter to show the task related to a specific model in the chatter. Is developed as a mixin. The mixin you can control the maximum number of task you want to see.
The following images are an examples.
Job in done state
job in pending state
The state updates automatically base on bus.bus and also it's possible to show exception message as result.
This is done in version 16.
================= QUEUE JOB CHATTER
This module add to chatter a panel to show for the related model the jobs that are in execution in queue job with same model and resource
THE PROBLEM
When we have buttons that will create job in the queue job and the user doesn't have any information about what is the state of the task or existence of the task.
PROPOSED SOLUTION
By listing the job in the chatter the user will have the means to know that a Job is in the queue and it's state.
For the cases that a task may create a job for other models, its possible to pass in the context the parent model and resource id. This will show the job task in the parent model with correct id.
HOW TO USE
The modules provide a mixin class ''queue.job.chatter.mixin'' that have to be inherited. The queue job chatter will only show for this model.
Example:
from odoo import models, fields, api
class MyModel(models.Model):
_name = 'my.model'
_inherit = ['mail.thread', 'queue.job.chatter.mixin']
_job_list_limit = 10
In the above example ''_job_list_limit'' is used to define the max number of jobs that should be in the chatter the default value is 5.
In the form view of the model must be added 2 fields
<field name="has_queue_job_mixin" invisible="1"/>
<field name="is_queue_job_manager" invisible="1"/>
Showing jobs from others models
Example:
some_model.with_context(parent_res_model_name=self._name, parent_res_id=self.id).with_delay().some_method()
In the above code ''some_model'' will be calling ''some_method'' with delay. By passing ''with_context'' the parameters ''parent_res_model_name'' and ''parent_res_id'' it will allow that the current model to find the job that is executing on another model.
Updates now allow to dismiss and also show result messages
Added support to show dependency jobs for job that will wait until another jobs are done