-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by guewen
- Loading branch information
Showing
18 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 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": "13.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 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 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 "" | ||
|
||
#. 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 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 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 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 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 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 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 <[email protected]> (https://www.acsone.eu/) |
This file contains 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 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 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.
This file contains 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,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 ACSONE SA/NV | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<record model="ir.ui.view" id="queue_job_function_form_view"> | ||
<field name="model">queue.job.function</field> | ||
<field name="inherit_id" ref="queue_job.view_queue_job_function_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='name']/.." position="after"> | ||
<group name="group_web_notify"> | ||
<field name="is_web_notify_failure_enabled" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains 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 @@ | ||
../../../../queue_job_web_notify |
This file contains 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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |