|
|
for record in self:
if self.env.user.has_group("mail_gateway.gateway_user"):
partners = record.notification_ids.res_partner_id
channels = partners.gateway_channel_ids.filtered(
lambda r, messages=record.gateway_message_ids: (
r.gateway_token,
r.gateway_id.id,
)
not in [
(
notification.gateway_channel_id.gateway_channel_token,
notification.gateway_channel_id.gateway_id.id,
)
for notification in messages.gateway_notification_ids
]
)
else:
channels = self.env["res.partner.gateway.channel"]
record.gateway_channel_ids = channels
record.gateway_channel_data = {
"channels": channels.ids,
"partners": channels.partner_id.ids,
}
|
|