-
-
Notifications
You must be signed in to change notification settings - Fork 532
[18.0][MIG] queue job web notify #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
hhgabelgaard
wants to merge
5
commits into
OCA:18.0
from
steingabelgaard:18.0-mig-queue_job_web_notify
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
89db2b9
[ADD] queue_job_web_notify: send web notifications from queue jobs
ThomasBinsfeld fd56e26
[UPD] Update queue_job_web_notify.pot
e116f39
[BOT] post-merge updates
OCA-git-bot 29c27f2
[IMP] queue_job_web_notify: pre-commit execution
hhgabelgaard 0a31a15
[MIG] queue_job_web_notify: Migration to 18.0
hhgabelgaard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| ==================== | ||
| Queue Job Web Notify | ||
| ==================== | ||
|
|
||
| .. | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! This file is generated by oca-gen-addon-readme !! | ||
| !! changes will be overwritten. !! | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| !! source digest: sha256:5323f093bbd847963317ba481fa1b5e7cf038371945dd75145ebc6d72af59e41 | ||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
|
||
| .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
| :target: https://odoo-community.org/page/development-status | ||
| :alt: Beta | ||
| .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
| .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github | ||
| :target: https://github.com/OCA/queue/tree/13.0/queue_job_web_notify | ||
| :alt: OCA/queue | ||
| .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
| :target: https://translation.odoo-community.org/projects/queue-13-0/queue-13-0-queue_job_web_notify | ||
| :alt: Translate me on Weblate | ||
| .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
| :target: https://runboat.odoo-community.org/builds?repo=OCA/queue&target_branch=13.0 | ||
| :alt: Try me on Runboat | ||
|
|
||
| |badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
|
||
| This module extends the mail notification feature of Queue Job. It adds | ||
| the possibility to enable the web notification of failed jobs. When | ||
| enabled, the user will be notified by a web notification. The web | ||
| notification is a pop-up message that appears in the user's browser. | ||
|
|
||
| **Table of contents** | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| Use Cases / Context | ||
| =================== | ||
|
|
||
| The notification feature of this module allows the user to get a | ||
| immediate feedback about the status of the job. | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| To configure this module, you need to: | ||
|
|
||
| - Go to the list of queue job functions | ||
| - Enable the web notify feature | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| To only usage of this module is its configuration: | ||
|
|
||
| - Go to the list of queue job functions | ||
| - Enable the web notify feature | ||
|
|
||
| Known issues / Roadmap | ||
| ====================== | ||
|
|
||
| - other notification contexts could be added (job started, job | ||
| finished, job canceled, etc.) | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
| `feedback <https://github.com/OCA/queue/issues/new?body=module:%20queue_job_web_notify%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
| Do not contact contributors directly about support or help with technical issues. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Authors | ||
| ------- | ||
|
|
||
| * ACSONE SA/NV | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| - Thomas Binsfeld thomas.binsfeld@acsone.eu (https://www.acsone.eu/) | ||
|
|
||
| Maintainers | ||
| ----------- | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/13.0/queue_job_web_notify>`_ project on GitHub. | ||
|
|
||
| You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright 2024 ACSONE SA/NV,Odoo Community Association (OCA) | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| { | ||
| "name": "Queue Job Web Notify", | ||
| "summary": """ | ||
| This module allows to display a notification to the related user of a | ||
| failed job. It uses the web_notify notification feature.""", | ||
| "version": "18.0.1.0.0", | ||
| "author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
| "website": "https://github.com/OCA/queue", | ||
| "license": "AGPL-3", | ||
| "category": "Generic Modules", | ||
| "depends": [ | ||
| # OCA/queue | ||
| "queue_job", | ||
| # OCA/web | ||
| "web_notify", | ||
| ], | ||
| "data": ["views/queue_job_function.xml"], | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * queue_job_web_notify | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 13.0+e\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "POT-Creation-Date: 2024-03-04 13:47+0000\n" | ||
| "PO-Revision-Date: 2024-03-04 13:47+0000\n" | ||
| "Last-Translator: \n" | ||
| "Language-Team: \n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: \n" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model.fields,help:queue_job_web_notify.field_queue_job_function__is_web_notify_failure_enabled | ||
| msgid "Display a notification in the user interface when the job fails." | ||
| msgstr "Affiche une notification dans l'interface utilisateur lorsque le job échoue." | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model,name:queue_job_web_notify.model_queue_job_function | ||
| msgid "Job Functions" | ||
| msgstr "" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: code:addons/queue_job_web_notify/models/queue_job.py:0 | ||
| #, python-format | ||
| msgid "Job failed" | ||
| msgstr "Job échoué" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model.fields,field_description:queue_job_web_notify.field_queue_job_function__is_web_notify_failure_enabled | ||
| msgid "Notify on failure" | ||
| msgstr "Notifier en cas d'échec" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model,name:queue_job_web_notify.model_queue_job | ||
| msgid "Queue Job" | ||
| msgstr "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Translation of Odoo Server. | ||
| # This file contains the translation of the following modules: | ||
| # * queue_job_web_notify | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Odoo Server 13.0\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "Last-Translator: \n" | ||
| "Language-Team: \n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: \n" | ||
| "Plural-Forms: \n" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model.fields,help:queue_job_web_notify.field_queue_job_function__is_web_notify_failure_enabled | ||
| msgid "Display a notification in the user interface when the job fails." | ||
| msgstr "" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model,name:queue_job_web_notify.model_queue_job_function | ||
| msgid "Job Functions" | ||
| msgstr "" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: code:addons/queue_job_web_notify/models/queue_job.py:0 | ||
| #, python-format | ||
| msgid "Job failed" | ||
| msgstr "" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model.fields,field_description:queue_job_web_notify.field_queue_job_function__is_web_notify_failure_enabled | ||
| msgid "Notify on failure" | ||
| msgstr "" | ||
|
|
||
| #. module: queue_job_web_notify | ||
| #: model:ir.model,name:queue_job_web_notify.model_queue_job | ||
| msgid "Queue Job" | ||
| msgstr "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import queue_job_function | ||
| from . import queue_job |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Copyright 2024 ACSONE SA/NV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import _, models | ||
|
|
||
|
|
||
| class QueueJob(models.Model): | ||
| _inherit = "queue.job" | ||
|
|
||
| def _get_web_notify_failure_title(self): | ||
| self.ensure_one() | ||
| return _("Job failed") | ||
|
|
||
| def _get_web_notify_failure_message(self): | ||
| self.ensure_one() | ||
| return self.display_name | ||
|
|
||
| def _message_post_on_failure(self): | ||
| res = super()._message_post_on_failure() | ||
| for job in self: | ||
| if not job.job_function_id.is_web_notify_failure_enabled: | ||
| continue | ||
| notification_title = job._get_web_notify_failure_title() | ||
| notification_message = job._get_web_notify_failure_message() | ||
| job.user_id.notify_danger( | ||
| message=notification_message, title=notification_title, sticky=True | ||
| ) | ||
| return res |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Copyright 2024 ACSONE SA/NV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class QueueJobFunction(models.Model): | ||
| _inherit = "queue.job.function" | ||
|
|
||
| is_web_notify_failure_enabled = fields.Boolean( | ||
| string="Notify on failure", | ||
| help="Display a notification in the user interface when the job fails.", | ||
| default=False, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| To configure this module, you need to: | ||
|
|
||
| - Go to the list of queue job functions | ||
| - Enable the web notify feature |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| The notification feature of this module allows the user to get a immediate feedback | ||
| about the status of the job. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Thomas Binsfeld <thomas.binsfeld@acsone.eu> (https://www.acsone.eu/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| This module extends the mail notification feature of Queue Job. It adds the possibility | ||
| to enable the web notification of failed jobs. When enabled, the user will be notified | ||
| by a web notification. The web notification is a pop-up message that appears in the | ||
| user's browser. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - other notification contexts could be added (job started, job finished, job canceled, | ||
| etc.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| To only usage of this module is its configuration: | ||
|
|
||
| - Go to the list of queue job functions | ||
| - Enable the web notify feature |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the migration were based off of 16 instead of 13, it would gain some translation commits:
https://github.com/OCA/queue/commits/16.0/queue_job_web_notify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amh-mw Good point
Closing this in favor of #830