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:
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
|
||||
Reference in New Issue
Block a user