mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] web_notify_channel_message
This commit is contained in:
@@ -0,0 +1 @@
|
||||
../../../../web_notify_channel_message
|
||||
6
setup/web_notify_channel_message/setup.py
Normal file
6
setup/web_notify_channel_message/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
0
web_notify_channel_message/README.rst
Normal file
0
web_notify_channel_message/README.rst
Normal file
1
web_notify_channel_message/__init__.py
Normal file
1
web_notify_channel_message/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
16
web_notify_channel_message/__manifest__.py
Normal file
16
web_notify_channel_message/__manifest__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# Copyright 2023 ForgeFlow, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Web Notify Channel Message",
|
||||
"summary": """
|
||||
Send an instant notification to channel users when a new message is posted""",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"development_status": "Alpha",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"depends": ["web_notify", "mail"],
|
||||
"installable": True,
|
||||
}
|
||||
1
web_notify_channel_message/models/__init__.py
Normal file
1
web_notify_channel_message/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import mail_channel
|
||||
21
web_notify_channel_message/models/mail_channel.py
Normal file
21
web_notify_channel_message/models/mail_channel.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# pylint: disable=missing-docstring
|
||||
# Copyright 2016 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import _, models
|
||||
|
||||
|
||||
class MailChannel(models.Model):
|
||||
_inherit = "mail.channel"
|
||||
|
||||
def message_post(self, *, message_type="notification", **kwargs):
|
||||
message = super().message_post(message_type=message_type, **kwargs)
|
||||
for partner in self.channel_partner_ids:
|
||||
users = partner.user_ids
|
||||
for user in users:
|
||||
if user in message.author_id.user_ids:
|
||||
continue
|
||||
user.notify_info(
|
||||
message=_("You have a new message in channel %s") % self.name
|
||||
)
|
||||
return message
|
||||
4
web_notify_channel_message/readme/CONTRIBUTORS.rst
Normal file
4
web_notify_channel_message/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
* Joan Sisquella <joan.sisquella@forgeflow.com>
|
||||
* Thiago Mulero <thiago.mulero@forgeflow.com>
|
||||
* David Jimenez <david.jimenez@forgeflow.com>
|
||||
* Jordi Ballester <jordi.ballester@forgefow.com>
|
||||
1
web_notify_channel_message/readme/DESCRIPTION.rst
Normal file
1
web_notify_channel_message/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
||||
This module will send an instant notifications to all users of a channel when a new message has been posted.
|
||||
Reference in New Issue
Block a user