|
| 1 | +======================= |
| 2 | +Job Queue Alert Running |
| 3 | +======================= |
| 4 | + |
| 5 | +.. |
| 6 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 7 | + !! This file is generated by oca-gen-addon-readme !! |
| 8 | + !! changes will be overwritten. !! |
| 9 | + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 10 | + !! source digest: sha256:09e6da1c23c22c23cef1bd7a94382d7d1229403def5111ede114c21ed49ac853 |
| 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_alert_running |
| 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_alert_running |
| 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 provides a mixin (``queue.job.status.mixin``) that adds a |
| 32 | +computed ``is_job_running`` boolean field and automatically displays a |
| 33 | +warning banner on form views when a record is currently the target of a |
| 34 | +non-terminal queue job, helping prevent concurrent editing of the same |
| 35 | +record. |
| 36 | + |
| 37 | +The flag is derived from the actual ``queue.job`` state (pending, |
| 38 | +enqueued, started, wait_dependencies), so there is nothing to call |
| 39 | +before or after a job: enqueue work with ``with_delay()`` and the banner |
| 40 | +reflects reality. |
| 41 | + |
| 42 | +**Table of contents** |
| 43 | + |
| 44 | +.. contents:: |
| 45 | + :local: |
| 46 | + |
| 47 | +Usage |
| 48 | +===== |
| 49 | + |
| 50 | +To use this module: |
| 51 | + |
| 52 | +1. Inherit ``queue.job.status.mixin`` in your model: |
| 53 | + |
| 54 | +.. code:: python |
| 55 | +
|
| 56 | + class MyModel(models.Model): |
| 57 | + _name = "my.model" |
| 58 | + _inherit = ["queue.job.status.mixin"] |
| 59 | +
|
| 60 | + def action_process(self): |
| 61 | + self.with_delay()._process_in_background() |
| 62 | +
|
| 63 | +The mixin computes ``is_job_running`` from the real ``queue.job`` state, |
| 64 | +so the banner appears while any job targets the record and disappears as |
| 65 | +soon as the job reaches a terminal state (done / failed / cancelled) |
| 66 | +even on error. |
| 67 | + |
| 68 | +When ``is_job_running`` is ``True``, a yellow warning banner appears at |
| 69 | +the top of the form view: *"This Record is running in queue job."* |
| 70 | + |
| 71 | +Bug Tracker |
| 72 | +=========== |
| 73 | + |
| 74 | +Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_. |
| 75 | +In case of trouble, please check there if your issue has already been reported. |
| 76 | +If you spotted it first, help us to smash it by providing a detailed and welcomed |
| 77 | +`feedback <https://github.com/OCA/queue/issues/new?body=module:%20queue_job_alert_running%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
| 78 | + |
| 79 | +Do not contact contributors directly about support or help with technical issues. |
| 80 | + |
| 81 | +Credits |
| 82 | +======= |
| 83 | + |
| 84 | +Authors |
| 85 | +------- |
| 86 | + |
| 87 | +* Ecosoft |
| 88 | + |
| 89 | +Contributors |
| 90 | +------------ |
| 91 | + |
| 92 | +- Saran Lim. <saranl@ecosoft.co.th> |
| 93 | + |
| 94 | +Maintainers |
| 95 | +----------- |
| 96 | + |
| 97 | +This module is maintained by the OCA. |
| 98 | + |
| 99 | +.. image:: https://odoo-community.org/logo.png |
| 100 | + :alt: Odoo Community Association |
| 101 | + :target: https://odoo-community.org |
| 102 | + |
| 103 | +OCA, or the Odoo Community Association, is a nonprofit organization whose |
| 104 | +mission is to support the collaborative development of Odoo features and |
| 105 | +promote its widespread use. |
| 106 | + |
| 107 | +.. |maintainer-Saran440| image:: https://github.com/Saran440.png?size=40px |
| 108 | + :target: https://github.com/Saran440 |
| 109 | + :alt: Saran440 |
| 110 | + |
| 111 | +Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: |
| 112 | + |
| 113 | +|maintainer-Saran440| |
| 114 | + |
| 115 | +This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/18.0/queue_job_alert_running>`_ project on GitHub. |
| 116 | + |
| 117 | +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
0 commit comments