diff --git a/mail_drop_target/README.rst b/mail_drop_target/README.rst new file mode 100644 index 000000000..b112d6f01 --- /dev/null +++ b/mail_drop_target/README.rst @@ -0,0 +1,94 @@ +========================== +Drag & drop emails to Odoo +========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/12.0/mail_drop_target + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_drop_target + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module was written to allow users to drag&drop emails from their desktop to Odoo. + +It supports as well RFC822 .eml files as Outlook .msg (those only if `an extra library `_ is installed) files. + +When the mail is dropped to an odoo record, it will automatically send a notification +of that new message that has been added to all the existing followers. It is possible +to disable this notification. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. save your emails on the desktop / somewhere in the file system +#. drag them to your browser, and drop them on the chatter of the record you want to attach your email to + +Known issues / Roadmap +====================== + +* most mail clients won't allow you to drag mails directly from the mail client, you'll need some plugin for that +* for corporate environments, it might be feasible to support imap URLs and get the mail in question on the server side + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Therp BV + +Contributors +~~~~~~~~~~~~ + +* Holger Brunn +* Enric Tobella + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_drop_target/__init__.py b/mail_drop_target/__init__.py new file mode 100644 index 000000000..be8574876 --- /dev/null +++ b/mail_drop_target/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2018 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from . import models diff --git a/mail_drop_target/__manifest__.py b/mail_drop_target/__manifest__.py new file mode 100644 index 000000000..427644fab --- /dev/null +++ b/mail_drop_target/__manifest__.py @@ -0,0 +1,13 @@ +# Copyright 2018 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Drag & drop emails to Odoo", + "version": "13.0.1.0.0", + "author": "Therp BV,Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Discuss", + "summary": "Attach emails to Odoo by dragging them from your desktop", + "depends": ["mail", "web_drop_target"], + "external_dependencies": {"python": ["extract_msg"]}, + "data": ["views/templates.xml", "views/res_config_settings_views.xml"], +} diff --git a/mail_drop_target/i18n/mail_drop_target.pot b/mail_drop_target/i18n/mail_drop_target.pot new file mode 100644 index 000000000..8c582da71 --- /dev/null +++ b/mail_drop_target/i18n/mail_drop_target.pot @@ -0,0 +1,63 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_drop_target +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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_drop_target +#: model:ir.model,name:mail_drop_target.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: mail_drop_target +#: model_terms:ir.ui.view,arch_db:mail_drop_target.res_config_settings_view_form +msgid "Disable Mail Drag&Drop Notification" +msgstr "" + +#. module: mail_drop_target +#: model:ir.model.fields,field_description:mail_drop_target.field_res_config_settings__disable_notify_mail_drop_target +msgid "Disable Notification followers on mail dropped to a Thread" +msgstr "" + +#. module: mail_drop_target +#: model:ir.model,name:mail_drop_target.model_mail_thread +msgid "Email Thread" +msgstr "" + +#. module: mail_drop_target +#: code:addons/mail_drop_target/models/mail_thread.py:53 +#, python-format +msgid "Install the msg-extractor library to handle .msg files" +msgstr "" + +#. module: mail_drop_target +#: model:ir.model,name:mail_drop_target.model_mail_message +msgid "Message" +msgstr "" + +#. module: mail_drop_target +#: code:addons/mail_drop_target/models/mail_thread.py:42 +#, python-format +msgid "This message is already imported." +msgstr "" + +#. module: mail_drop_target +#: model_terms:ir.ui.view,arch_db:mail_drop_target.res_config_settings_view_form +msgid "When a user drops an email into an existing thread\n" +" the followers of the thread will not be notified." +msgstr "" + +#. module: mail_drop_target +#: model:ir.model.fields,help:mail_drop_target.field_res_config_settings__disable_notify_mail_drop_target +msgid "When this setting is set, when a user drops an email into an existing thread the followers of the thread will not be notified. This sets an ir.config.parameter mail_drop_target.disable_notify" +msgstr "" + diff --git a/mail_drop_target/models/__init__.py b/mail_drop_target/models/__init__.py new file mode 100644 index 000000000..f11e7bf03 --- /dev/null +++ b/mail_drop_target/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2018 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from . import mail_thread +from . import res_config_settings diff --git a/mail_drop_target/models/mail_thread.py b/mail_drop_target/models/mail_thread.py new file mode 100644 index 000000000..22d30f47f --- /dev/null +++ b/mail_drop_target/models/mail_thread.py @@ -0,0 +1,136 @@ +# Copyright 2018 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from base64 import b64decode + +from odoo import _, api, exceptions, models + +try: + from extract_msg import Message +except ImportError: + Message = None + + +class MailThread(models.AbstractModel): + _inherit = "mail.thread" + + @api.model + def message_drop( + self, + model, + message, + custom_values=None, + save_original=False, + strip_attachments=False, + thread_id=None, + ): + disable_notify_mail_drop_target = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("mail_drop_target.disable_notify", default=False) + ) + self_message_process = self + if disable_notify_mail_drop_target: + self_message_process = self_message_process.with_context( + message_create_from_mail_mail=True + ) + result = self_message_process.message_process( + model, + message, + custom_values=custom_values, + save_original=save_original, + strip_attachments=strip_attachments, + thread_id=thread_id, + ) + if not result: + return self.message_drop_existing( + model, + message, + custom_values=custom_values, + save_original=save_original, + strip_attachments=strip_attachments, + thread_id=thread_id, + ) + return result + + @api.model + def message_drop_existing( + self, + model, + message, + custom_values=None, + save_original=False, + strip_attachments=False, + thread_id=None, + ): + message = _("This message is already imported.") + raise exceptions.Warning(message) + + @api.model + def message_process_msg( + self, + model, + message, + custom_values=None, + save_original=False, + strip_attachments=False, + thread_id=None, + ): + """Convert message to RFC2822 and pass to message_process""" + if not Message: + raise exceptions.UserError( + _("Install the msg-extractor library to handle .msg files") + ) + message_msg = Message(b64decode(message)) + try: + message_id = message_msg.messageId + except AttributeError: + # Using extract_msg < 0.24.4 + message_id = message_msg.message_id + message_email = self.env["ir.mail_server"].build_email( + message_msg.sender, + message_msg.to.split(","), + message_msg.subject, + # prefer html bodies to text + message_msg._getStream("__substg1.0_10130102") or message_msg.body, + email_cc=message_msg.cc, + headers={"date": message_msg.date}, + message_id=message_id, + attachments=[ + (attachment.longFilename, attachment.data) + for attachment in message_msg.attachments + ], + ) + return self.message_drop( + model, + message_email.as_string(), + custom_values=custom_values, + save_original=save_original, + strip_attachments=strip_attachments, + thread_id=thread_id, + ) + + def _notify_record_by_email( + self, + message, + recipients_data, + msg_vals=False, + model_description=False, + mail_auto_delete=True, + check_existing=False, + force_send=True, + send_after_commit=True, + **kwargs, + ): + if self.env.context.get("message_create_from_mail_mail", False): + return + return super()._notify_record_by_email( + message, + recipients_data, + msg_vals=msg_vals, + model_description=model_description, + mail_auto_delete=mail_auto_delete, + check_existing=check_existing, + force_send=force_send, + send_after_commit=send_after_commit, + **kwargs, + ) diff --git a/mail_drop_target/models/res_config_settings.py b/mail_drop_target/models/res_config_settings.py new file mode 100644 index 000000000..6122fb002 --- /dev/null +++ b/mail_drop_target/models/res_config_settings.py @@ -0,0 +1,17 @@ +# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + disable_notify_mail_drop_target = fields.Boolean( + "Disable Notification followers on mail dropped to a Thread", + config_parameter="mail_drop_target.disable_notify", + help="When this setting is set, when a user drops an " + "email into an existing thread the followers of the thread will " + "not be notified. This sets an ir.config.parameter " + "mail_drop_target.disable_notify", + ) diff --git a/mail_drop_target/readme/CONFIGURATION.rst b/mail_drop_target/readme/CONFIGURATION.rst new file mode 100644 index 000000000..79e2eb7b3 --- /dev/null +++ b/mail_drop_target/readme/CONFIGURATION.rst @@ -0,0 +1,3 @@ +To disable the automatic notification to existing followers when you drop an +email to a record, go to *Settings*, activate the developer mode, and then go to +*Settings / General Settings* and set the flag 'Disable Mail Drag&Drop Notification'. diff --git a/mail_drop_target/readme/CONTRIBUTORS.rst b/mail_drop_target/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..3641c4c34 --- /dev/null +++ b/mail_drop_target/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Holger Brunn +* Enric Tobella +* Lois Rilo diff --git a/mail_drop_target/readme/DESCRIPTION.rst b/mail_drop_target/readme/DESCRIPTION.rst new file mode 100644 index 000000000..c017ccdff --- /dev/null +++ b/mail_drop_target/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +This module was written to allow users to drag&drop emails from their desktop to Odoo. + +It supports as well RFC822 .eml files as Outlook .msg (those only if `an extra library `_ is installed) files. + +When the mail is dropped to an odoo record, it will automatically send a notification +of that new message that has been added to all the existing followers. It is possible +to disable this notification. diff --git a/mail_drop_target/readme/ROADMAP.rst b/mail_drop_target/readme/ROADMAP.rst new file mode 100644 index 000000000..6e2dc0854 --- /dev/null +++ b/mail_drop_target/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* most mail clients won't allow you to drag mails directly from the mail client, you'll need some plugin for that +* for corporate environments, it might be feasible to support imap URLs and get the mail in question on the server side diff --git a/mail_drop_target/readme/USAGE.rst b/mail_drop_target/readme/USAGE.rst new file mode 100644 index 000000000..080e2b51f --- /dev/null +++ b/mail_drop_target/readme/USAGE.rst @@ -0,0 +1,4 @@ +To use this module, you need to: + +#. save your emails on the desktop / somewhere in the file system +#. drag them to your browser, and drop them on the chatter of the record you want to attach your email to diff --git a/mail_drop_target/static/description/icon.png b/mail_drop_target/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mail_drop_target/static/description/icon.png differ diff --git a/mail_drop_target/static/description/index.html b/mail_drop_target/static/description/index.html new file mode 100644 index 000000000..00dd0edae --- /dev/null +++ b/mail_drop_target/static/description/index.html @@ -0,0 +1,441 @@ + + + + + + +Drag & drop emails to Odoo + + + +
+

Drag & drop emails to Odoo

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runbot

+

This module was written to allow users to drag&drop emails from their desktop to Odoo.

+

It supports as well RFC822 .eml files as Outlook .msg (those only if an extra library is installed) files.

+

When the mail is dropped to an odoo record, it will automatically send a notification +of that new message that has been added to all the existing followers. It is possible +to disable this notification.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. save your emails on the desktop / somewhere in the file system
  2. +
  3. drag them to your browser, and drop them on the chatter of the record you want to attach your email to
  4. +
+
+
+

Known issues / Roadmap

+
    +
  • most mail clients won’t allow you to drag mails directly from the mail client, you’ll need some plugin for that
  • +
  • for corporate environments, it might be feasible to support imap URLs and get the mail in question on the server side
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_drop_target/static/src/css/mail_drop_target.css b/mail_drop_target/static/src/css/mail_drop_target.css new file mode 100644 index 000000000..1056f02e9 --- /dev/null +++ b/mail_drop_target/static/src/css/mail_drop_target.css @@ -0,0 +1,3 @@ +.o-mail-drag-over { + filter: blur(2px); +} diff --git a/mail_drop_target/static/src/js/mail_drop_target.js b/mail_drop_target/static/src/js/mail_drop_target.js new file mode 100644 index 000000000..2c8dbf97e --- /dev/null +++ b/mail_drop_target/static/src/js/mail_drop_target.js @@ -0,0 +1,68 @@ +// -*- coding: utf-8 -*- +// Copyright 2018 Therp BV +// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +odoo.define('mail_drop_target', function (require) { + "use strict"; + var Chatter = require('mail.Chatter'); + var web_drop_target = require('web_drop_target'); + + Chatter.include(web_drop_target.DropTargetMixin); + + Chatter.include({ + _drop_allowed_types: ['message/rfc822'], + _get_record_id: function() { + return this.record.res_id; + }, + + _handle_drop_items: function (drop_items, e) { + var self = this; + _.each(drop_items, function(item, e) { + return self._handle_file_drop_proxy(item, e); + }); + }, + _handle_file_drop_proxy: function (item, e) { + var self = this; + var file = item; + if (!file || !(file instanceof Blob)) { + return; + } + var reader = new FileReader(); + reader.onloadend = self.proxy( + _.partial(self._handle_file_drop, file, reader, e) + ); + reader.onerror = self.proxy('_file_reader_error_handler'); + reader.readAsArrayBuffer(file); + }, + _handle_file_drop: function (drop_file, reader, e) { + var self = this, + mail_processor = '', + data = ''; + if (drop_file.name.endsWith('.msg')) { + mail_processor = 'message_process_msg'; + data = base64js.fromByteArray( + new Uint8Array(reader.result) + ); + } else { + mail_processor = 'message_drop'; + var reader_array = new Uint8Array(reader.result); + data = ""; + for (var i = 0; i < reader_array.length; i++) { + data += String.fromCharCode(parseInt(reader_array[i])); + } + } + // TODO: read some config parameter if this should set + // some of the context keys to suppress mail.thread's behavior + return this._rpc({ + model:'mail.thread', + method:mail_processor, + args: [this.record.model, data], + kwargs: { + thread_id: this.record.data.id, + }, + }).then(function() { + self.trigger_up('reload', {}); + }); + }, + }); +}); diff --git a/mail_drop_target/tests/__init__.py b/mail_drop_target/tests/__init__.py new file mode 100644 index 000000000..1dd00d054 --- /dev/null +++ b/mail_drop_target/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mail_drop_target diff --git a/mail_drop_target/tests/sample.eml b/mail_drop_target/tests/sample.eml new file mode 100644 index 000000000..cd2cfa6ef --- /dev/null +++ b/mail_drop_target/tests/sample.eml @@ -0,0 +1,75 @@ +X-MDAV-Result: clean +X-MDAV-Processed: mail3.creublanca.es, Wed, 26 Jun 2019 18:08:19 +0200 +Return-path: +Authentication-Results: mail3.creublanca.es; + auth=pass (login) smtp.auth=etobella@creublanca.es +Received: from WorldClient by creublanca.es with ESMTPA id md50020655392.msg; + Wed, 26 Jun 2019 18:08:19 +0200 +X-Spam-Processed: mail3.creublanca.es, Wed, 26 Jun 2019 18:08:19 +0200 + (not processed: message from trusted or authenticated source) +X-MDArrival-Date: Wed, 26 Jun 2019 18:08:19 +0200 +X-Authenticated-Sender: etobella@creublanca.es +X-Rcpt-To: etobella@creublanca.es +X-MDRcpt-To: etobella@creublanca.es +X-Return-Path: prvs=10800b8cdb=etobella@creublanca.es +X-Envelope-From: etobella@creublanca.es +X-MDaemon-Deliver-To: etobella@creublanca.es +Received: by creublanca.es via MDaemon Webmail with HTTP; + Wed, 26 Jun 2019 18:08:16 +0200 +Date: Wed, 26 Jun 2019 18:08:16 +0200 +From: "Enric Tobella" +To: "Enric Tobella" +Subject: Test +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0626-1608-16-03-PART_BREAK" +Message-ID: +X-Mailer: MDaemon Webmail 19.0.2 + +--0626-1608-16-03-PART_BREAK +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +TEST + + + + +Tanto este mensaje como los documentos que, en su caso, lleve como anexos, +pueden contener informacin reservada y/o confidencial, destinada exclusivamente +para el uso del destinatario o la persona responsable de entregarlo al mismo, +estando su uso no autorizado prohibido legalmente. +Su contenido no constituye un compromiso para Creu Blanca (la empresa remitente) +salvo ratificacin escrita por ambas partes. En caso de su recepcin por error, +rogamos nos lo comunique por igual va, se abstenga de realizar copias del mensaje +o documentos adjuntos, remitirlo o facilitarlo a un tercero, y proceda en su defecto, +a su eliminacin. + +--0626-1608-16-03-PART_BREAK +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + + +
TEST
+

+
+
+Tanto este mensaje como los documentos que, en su caso, lleve como anexos, = +
+pueden contener informaci=F3n reservada y/o confidencial, destinada exclusi= +vamente
+para el uso del destinatario o la persona responsable de entregarlo al mism= +o,
+estando su uso no autorizado prohibido legalmente.
+Su contenido no constituye un compromiso para Creu Blanca (la empresa remit= +ente)
+salvo ratificaci=F3n escrita por ambas partes. En caso de su recepci=F3n po= +r error,
+rogamos nos lo comunique por igual v=EDa, se abstenga de realizar copias de= +l mensaje
+o documentos adjuntos, remitirlo o facilitarlo a un tercero, y proceda en s= +u defecto,
+a su eliminaci=F3n.
+ + +--0626-1608-16-03-PART_BREAK-- diff --git a/mail_drop_target/tests/sample.msg b/mail_drop_target/tests/sample.msg new file mode 100644 index 000000000..0a5ffcd82 Binary files /dev/null and b/mail_drop_target/tests/sample.msg differ diff --git a/mail_drop_target/tests/test_mail_drop_target.py b/mail_drop_target/tests/test_mail_drop_target.py new file mode 100644 index 000000000..45192e39c --- /dev/null +++ b/mail_drop_target/tests/test_mail_drop_target.py @@ -0,0 +1,77 @@ +import base64 + +from mock import patch + +from odoo import exceptions, tools +from odoo.tests.common import SavepointCase + + +class TestMailDropTarget(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.partner = cls.env["res.partner"].create({"name": "TEST PARTNER"}) + cls.partner.message_subscribe(partner_ids=cls.partner.ids) + + def test_eml(self): + message = tools.file_open( + "sample.eml", subdir="addons/mail_drop_target/tests" + ).read() + comments = len(self.partner.message_ids) + self.partner.message_process( + self.partner._name, message, thread_id=self.partner.id + ) + self.partner.refresh() + self.assertEqual(comments + 1, len(self.partner.message_ids)) + with self.assertRaises(exceptions.Warning): + self.partner.message_drop( + self.partner._name, message, thread_id=self.partner.id + ) + + def test_msg(self): + message = base64.b64encode( + tools.file_open( + "sample.msg", mode="rb", subdir="addons/mail_drop_target/tests" + ).read() + ) + comments = len(self.partner.message_ids) + self.partner.message_process_msg( + self.partner._name, message, thread_id=self.partner.id + ) + self.partner.refresh() + self.assertEqual(comments + 1, len(self.partner.message_ids)) + msg = self.partner.message_ids.filtered(lambda m: m.subject == "Test") + self.assertIsNotNone(msg.notified_partner_ids) + with self.assertRaises(exceptions.Warning): + self.partner.message_process_msg( + self.partner._name, message, thread_id=self.partner.id + ) + + def test_no_msgextract(self): + with self.assertRaises(exceptions.UserError), patch( + "odoo.addons.mail_drop_target.models.mail_thread.Message", new=False + ): + self.test_msg() + + def test_msg_no_notification(self): + message = base64.b64encode( + tools.file_open( + "sample.msg", mode="rb", subdir="addons/mail_drop_target/tests" + ).read() + ) + settings = self.env["res.config.settings"].create({}) + settings.disable_notify_mail_drop_target = True + settings.execute() + comments = len(self.partner.message_ids) + self.partner.message_process_msg( + self.partner._name, message, thread_id=self.partner.id + ) + self.partner.refresh() + self.assertEqual(comments + 1, len(self.partner.message_ids)) + msg = self.partner.message_ids.filtered(lambda m: m.subject == "Test") + self.assertEqual(len(msg.notified_partner_ids), 0) + with self.assertRaises(exceptions.Warning): + self.partner.message_process_msg( + self.partner._name, message, thread_id=self.partner.id + ) diff --git a/mail_drop_target/views/res_config_settings_views.xml b/mail_drop_target/views/res_config_settings_views.xml new file mode 100644 index 000000000..e4a04dbe2 --- /dev/null +++ b/mail_drop_target/views/res_config_settings_views.xml @@ -0,0 +1,26 @@ + + + + + res.config.settings.view.form.inherit.mail + res.config.settings + + +
+
+
+ +
+
+
+
+
+
+
+
+
diff --git a/mail_drop_target/views/templates.xml b/mail_drop_target/views/templates.xml new file mode 100644 index 000000000..44031fc72 --- /dev/null +++ b/mail_drop_target/views/templates.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/oca_dependencies.txt b/oca_dependencies.txt index 9c8c9172c..f3ae43609 100644 --- a/oca_dependencies.txt +++ b/oca_dependencies.txt @@ -1 +1,2 @@ server-tools +web diff --git a/requirements.txt b/requirements.txt index 259d57361..d0102612d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ premailer +extract-msg