Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mail_external_confirmation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==========================
Mail External Confirmation
==========================
This module will show confirmation dialog while sending message
from chatter when any one follower of the record is not internal user.

Displays a confirmation dialog when mentioning (@) an external user
in chatter messages or internal notes.

Triggers a confirmation popup when all followers are removed,but the message
is still being sent to partner email addresses that are not internal users.
1 change: 1 addition & 0 deletions mail_external_confirmation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import controllers
30 changes: 30 additions & 0 deletions mail_external_confirmation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Mail External Confirmation",
"version": "18.0.1.0.0",
"summary": """
This module will show confirmation dialog while sending message
from chatter when any one follower of the record is not internal user.
- Pupup the message when anyone mension in chatter or notes
Displays a confirmation dialog when mentioning (@) an external user
in chatter messages or internal notes.
- Triggers a confirmation popup when all followers are removed,
but the message is still being sent to partner email addresses
that are not internal users.
""",
"author": "Nitrokey GmbH",
"license": "LGPL-3",
"website": "https://github.com/nitrokey/odoo-modules",
"maintainer": "Nitrokey GmbH",
"depends": ["mail", "base"],
"data": [],
"installable": True,
"assets": {
"web.assets_backend": [
(
"after",
"mail/static/src/core/common/composer.js",
"mail_external_confirmation/static/src/core/common/composer.js",
),
],
},
}
1 change: 1 addition & 0 deletions mail_external_confirmation/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
55 changes: 55 additions & 0 deletions mail_external_confirmation/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import logging

from odoo import http
from odoo.http import request

_logger = logging.getLogger(__name__)


class MessageExternalUserController(http.Controller):
@http.route("/message/external_users/check", type="json", auth="user")
def check_external_users(
self, rec_id, model, msg_type=False, mentioned_partner_ids=None
):
"""To check for external users exist in record followers"""
confirmation_message = (
"Your message will be sent to external partners (e.g. customers)."
)
popup_confirmation_msg = {
"needs_confirmation": True,
"confirmation_message": confirmation_message,
}
# Check mentioned partners (Note)
if mentioned_partner_ids:
partners = request.env["res.partner"].browse(mentioned_partner_ids).exists()

for partner in partners:
# If partner has no users at all, they're external
if not partner.user_ids:
return popup_confirmation_msg

# Check if any user is not internal
for user in partner.user_ids:
if not user.has_group("base.group_user"):
return popup_confirmation_msg

# Check thread followers (Messages)
if msg_type != "note":
record = request.env[model].browse(rec_id)
followers = record.message_follower_ids
for follower in followers:
partner = follower.partner_id

# If partner has no users at all, they're external
if not partner.user_ids:
return popup_confirmation_msg

# Check if any user is not internal
for user in partner.user_ids:
if not user.has_group("base.group_user"):
return popup_confirmation_msg

return {
"needs_confirmation": False,
"confirmation_message": "",
}
50 changes: 50 additions & 0 deletions mail_external_confirmation/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_external_confirmation
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-07-05 12:47+0000\n"
"PO-Revision-Date: 2022-07-05 12: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: mail_external_confirmation
#. openerp-web
#: code:addons/mail_external_confirmation/static/src/core/common/composer.js:0
#, python-format
msgid ""
"Your message will be sent to external partners (e.g. customers)."
msgstr "Ihre Nachricht wird an externe Partner (z.B. Kunden) gesendet."

#. module: mail_external_confirmation
#. openerp-web
#: code:addons/mail_external_confirmation/static/src/core/common/composer.js:0
#, python-format
msgid "Cancel"
msgstr "Abbrechen"

#. module: mail_external_confirmation
#: model:ir.model,name:mail_external_confirmation.model_res_partner
msgid "Contact"
msgstr ""

#. module: mail_external_confirmation
#. openerp-web
#: code:addons/mail_external_confirmation/static/src/core/common/composer.js:0
#, python-format
msgid "Please wait while the file is uploading."
msgstr ""

#. module: mail_external_confirmation
#. openerp-web
#: code:addons/mail_external_confirmation/static/src/core/common/composer.js:0
#, python-format
msgid "Send"
msgstr "Senden"
Empty file.
2 changes: 2 additions & 0 deletions mail_external_confirmation/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module will show confirmation dialog while sending message
from chatter when any one follower of the record is not internal user.
Loading