diff --git a/mail_activity_team/__manifest__.py b/mail_activity_team/__manifest__.py index 4963644fb..10f17cac0 100644 --- a/mail_activity_team/__manifest__.py +++ b/mail_activity_team/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Mail Activity Team', 'summary': 'Add Teams to Activities', - 'version': '11.0.1.0.0', + 'version': '11.0.2.0.0', 'development_status': 'Beta', 'category': 'Social Network', 'website': 'https://github.com/OCA/social', diff --git a/mail_activity_team/i18n/mail_activity_team.pot b/mail_activity_team/i18n/mail_activity_team.pot index 86ebed849..ac7f70fab 100644 --- a/mail_activity_team/i18n/mail_activity_team.pot +++ b/mail_activity_team/i18n/mail_activity_team.pot @@ -101,7 +101,7 @@ msgid "Name" msgstr "" #. module: mail_activity_team -#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team_id_2775 +#: model:ir.model.fields,field_description:mail_activity_team.field_mail_activity_team_id_2777 #: model:ir.ui.view,arch_db:mail_activity_team.mail_activity_view_search msgid "Team" msgstr "" diff --git a/mail_tracking/README.rst b/mail_tracking/README.rst index 81b7ba253..24a693d7f 100644 --- a/mail_tracking/README.rst +++ b/mail_tracking/README.rst @@ -1,15 +1,39 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg +============== +Email tracking +============== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/11.0/mail_tracking + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_tracking + :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/11.0 + :alt: Try me on Runbot -============= -Mail tracking -============= +|badge1| |badge2| |badge3| |badge4| |badge5| This module shows email notification tracking status for any messages in mail thread (chatter). Each notified partner will have an intuitive icon just right to his name. +**Table of contents** + +.. contents:: + :local: + Installation ============ @@ -22,6 +46,12 @@ For example, ``--load=web,mail_tracking`` Usage ===== +If you want to see all tracking emails and events you can go to + +* Settings > Technical > Email > Tracking emails +* Settings > Technical > Email > Tracking events + + When user sends a message in mail_thread (chatter), for instance in partner form, then an email tracking is created for each email notification. Then a status icon will appear just right to name of notified partner. @@ -46,6 +76,9 @@ These are all available status icons: .. |unknown| image:: static/src/img/unknown.png :width: 10px +.. |cc| image:: static/src/img/cc.png + :width: 10px + |unknown| **Unknown**: No email tracking info available. Maybe this notified partner has 'Receive Inbox Notifications by Email' == 'Never' |waiting| **Waiting**: Waiting to be sent @@ -58,38 +91,28 @@ These are all available status icons: |opened| **Opened**: Opened by partner - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/205/11.0 - -If you want to see all tracking emails and events you can go to - -* Settings > Technical > Email > Tracking emails -* Settings > Technical > Email > Tracking events - +|cc| **Cc**: It's a Carbon-Copy recipient. Can't know the status so is 'Unknown' 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. +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 ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. -* Thanks to `LlubNek `_ and `Openclipart - `_ for `the icon - `_. +* Tecnativa Contributors ------------- +~~~~~~~~~~~~ * `Tecnativa `_: @@ -97,18 +120,21 @@ Contributors * Antonio Espinosa * David Vidal * Rafael Blasco + * Alexandre Díaz -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +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_tracking/__manifest__.py b/mail_tracking/__manifest__.py index 7ed8713b4..396f07f7e 100644 --- a/mail_tracking/__manifest__.py +++ b/mail_tracking/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Email tracking", "summary": "Email tracking system for all mails sent", - "version": "11.0.1.2.0", + "version": "11.0.2.0.0", "category": "Social Network", "website": "http://github.com/OCA/social", "author": "Tecnativa, " diff --git a/mail_tracking/i18n/mail_tracking.pot b/mail_tracking/i18n/mail_tracking.pot index 362f26667..c9430cb2d 100644 --- a/mail_tracking/i18n/mail_tracking.pot +++ b/mail_tracking/i18n/mail_tracking.pot @@ -27,6 +27,12 @@ msgid " * The 'Error' status indicates that there was an error when trying to se "" msgstr "" +#. module: mail_tracking +#: model:ir.model.fields,help:mail_tracking.field_mail_compose_message_email_cc +#: model:ir.model.fields,help:mail_tracking.field_mail_message_email_cc +msgid "Additional recipients that receive a \"Carbon Copy\" of the e-mail" +msgstr "" + #. module: mail_tracking #: model:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_event_search msgid "Bounce" @@ -47,6 +53,15 @@ msgstr "" msgid "Bounced" msgstr "" +#. module: mail_tracking +#: code:addons/mail_tracking/models/mail_thread.py:36 +#: code:addons/mail_tracking/models/mail_thread.py:41 +#: model:ir.model.fields,field_description:mail_tracking.field_mail_compose_message_email_cc +#: model:ir.model.fields,field_description:mail_tracking.field_mail_message_email_cc +#, python-format +msgid "Cc" +msgstr "" + #. module: mail_tracking #: model:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_event_search msgid "Click" @@ -141,6 +156,11 @@ msgstr "" msgid "Email Score" msgstr "" +#. module: mail_tracking +#: model:ir.model,name:mail_tracking.model_mail_thread +msgid "Email Thread" +msgstr "" + #. module: mail_tracking #: model:ir.ui.view,arch_db:mail_tracking.view_res_partner_filter msgid "Email bounced" @@ -389,6 +409,13 @@ msgstr "" msgid "State" msgstr "" +#. module: mail_tracking +#. openerp-web +#: code:addons/mail_tracking/static/src/xml/mail_tracking.xml:98 +#, python-format +msgid "Status: unknown" +msgstr "" + #. module: mail_tracking #: model:ir.model.fields,field_description:mail_tracking.field_mail_tracking_email_name #: model:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_email_search @@ -405,7 +432,7 @@ msgstr "" #. module: mail_tracking #. openerp-web -#: code:addons/mail_tracking/static/src/xml/mail_tracking.xml:46 +#: code:addons/mail_tracking/static/src/xml/mail_tracking.xml:52 #, python-format msgid "To:" msgstr "" diff --git a/mail_tracking/models/__init__.py b/mail_tracking/models/__init__.py index f0ebf2ac4..6265ff520 100644 --- a/mail_tracking/models/__init__.py +++ b/mail_tracking/models/__init__.py @@ -6,3 +6,4 @@ from . import mail_message from . import mail_tracking_email from . import mail_tracking_event from . import res_partner +from . import mail_thread diff --git a/mail_tracking/models/mail_mail.py b/mail_tracking/models/mail_mail.py index 2625f4c34..930603919 100644 --- a/mail_tracking/models/mail_mail.py +++ b/mail_tracking/models/mail_mail.py @@ -4,7 +4,6 @@ import time from datetime import datetime from email.utils import COMMASPACE - from odoo import models, fields diff --git a/mail_tracking/models/mail_message.py b/mail_tracking/models/mail_message.py index a6bcc6831..38d10e063 100644 --- a/mail_tracking/models/mail_message.py +++ b/mail_tracking/models/mail_message.py @@ -1,12 +1,18 @@ # Copyright 2016 Antonio Espinosa - +# Copyright 2019 Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import models, api +from odoo import models, api, fields +from odoo.tools import email_split class MailMessage(models.Model): _inherit = "mail.message" + # Recipients + email_cc = fields.Char("Cc", help='Additional recipients that receive a ' + '"Carbon Copy" of the e-mail') + def _tracking_status_map_get(self): return { 'False': 'waiting', @@ -58,10 +64,37 @@ class MailMessage(models.Model): for partner in partners: # If there is partners not included, then status is 'unknown' partner_trackings.append(( - 'unknown', False, partner.name, partner.id)) + 'unknown', False, partner.name, partner.id, partner.email)) res[message.id] = partner_trackings return res + @api.multi + def _get_email_cc(self): + """This method gets all Cc mails and the associated partner if exist. + The result is a dictionary by 'message id' with a list of tuples + (str:email_cc, list:[partner id, partner display_name] or False) + """ + res = {} + ResPartnerObj = self.env['res.partner'] + for message in self: + email_cc_list = email_split(message.email_cc) + email_cc_list_checked = [] + if any(email_cc_list): + partners = ResPartnerObj.search([ + ('email', 'in', email_cc_list) + ]) + email_cc_list = set(email_cc_list) + for partner in partners: + email_cc_list.discard(partner.email) + email_cc_list_checked.append( + (partner.email, [partner.id, partner.display_name])) + for email in email_cc_list: + email_cc_list_checked.append((email, False)) + res.update({ + message.id: email_cc_list_checked + }) + return res + @api.model def _message_read_dict_postprocess(self, messages, message_tree): res = super(MailMessage, self)._message_read_dict_postprocess( @@ -69,9 +102,11 @@ class MailMessage(models.Model): mail_message_ids = {m.get('id') for m in messages if m.get('id')} mail_messages = self.browse(mail_message_ids) partner_trackings = mail_messages.tracking_status() + email_cc = mail_messages._get_email_cc() for message_dict in messages: mail_message_id = message_dict.get('id', False) if mail_message_id: message_dict['partner_trackings'] = \ partner_trackings[mail_message_id] + message_dict['email_cc'] = email_cc[mail_message_id] return res diff --git a/mail_tracking/models/mail_thread.py b/mail_tracking/models/mail_thread.py new file mode 100644 index 000000000..c5ce2acef --- /dev/null +++ b/mail_tracking/models/mail_thread.py @@ -0,0 +1,42 @@ +# Copyright 2019 Alexandre Díaz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, api, _ +from email.utils import getaddresses +from odoo.tools import email_split_and_format + + +class MailThread(models.AbstractModel): + _inherit = "mail.thread" + + @api.multi + @api.returns('self', lambda value: value.id) + def message_post(self, *args, **kwargs): + new_message = super().message_post(*args, **kwargs) + email_cc = kwargs.get('cc') + if email_cc: + new_message.sudo().write({ + 'email_cc': email_cc, + }) + return new_message + + @api.multi + def message_get_suggested_recipients(self): + res = super().message_get_suggested_recipients() + ResPartnerObj = self.env['res.partner'] + for record in self: + messages = record.message_ids.filtered('email_cc') + for msg in messages: + email_cc_list = email_split_and_format(msg.email_cc) + for cc in email_cc_list: + email_parts = getaddresses([cc])[0] + partner_id = record.message_partner_info_from_emails( + [email_parts[1]])[0].get('partner_id') + if not partner_id: + res[record.id].append((False, cc, _('Cc'))) + else: + partner = ResPartnerObj.browse(partner_id, + self._prefetch) + record._message_add_suggested_recipient( + res, partner=partner, reason=_('Cc')) + return res diff --git a/mail_tracking/readme/CONTRIBUTORS.rst b/mail_tracking/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..b337068a4 --- /dev/null +++ b/mail_tracking/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* `Tecnativa `_: + + * Pedro M. Baeza + * Antonio Espinosa + * David Vidal + * Rafael Blasco + * Alexandre Díaz diff --git a/mail_tracking/readme/DESCRIPTION.rst b/mail_tracking/readme/DESCRIPTION.rst new file mode 100644 index 000000000..d8dbc8bf8 --- /dev/null +++ b/mail_tracking/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module shows email notification tracking status for any messages in +mail thread (chatter). Each notified partner will have an intuitive icon just +right to his name. diff --git a/mail_tracking/readme/INSTALL.rst b/mail_tracking/readme/INSTALL.rst new file mode 100644 index 000000000..cb09d4c4b --- /dev/null +++ b/mail_tracking/readme/INSTALL.rst @@ -0,0 +1,5 @@ +If you're using a multi-database installation (with or without dbfilter option) +where /web/databse/selector returns a list of more than one database, then +you need to add ``mail_tracking`` addon to wide load addons list +(by default, only ``web`` addon), setting ``--load`` option. +For example, ``--load=web,mail_tracking`` diff --git a/mail_tracking/readme/USAGE.rst b/mail_tracking/readme/USAGE.rst new file mode 100644 index 000000000..aff1328d2 --- /dev/null +++ b/mail_tracking/readme/USAGE.rst @@ -0,0 +1,46 @@ +If you want to see all tracking emails and events you can go to + +* Settings > Technical > Email > Tracking emails +* Settings > Technical > Email > Tracking events + + +When user sends a message in mail_thread (chatter), for instance in partner +form, then an email tracking is created for each email notification. Then a +status icon will appear just right to name of notified partner. + +These are all available status icons: + +.. |sent| image:: static/src/img/sent.png + :width: 10px + +.. |delivered| image:: static/src/img/delivered.png + :width: 15px + +.. |opened| image:: static/src/img/opened.png + :width: 15px + +.. |error| image:: static/src/img/error.png + :width: 10px + +.. |waiting| image:: static/src/img/waiting.png + :width: 10px + +.. |unknown| image:: static/src/img/unknown.png + :width: 10px + +.. |cc| image:: static/src/img/cc.png + :width: 10px + +|unknown| **Unknown**: No email tracking info available. Maybe this notified partner has 'Receive Inbox Notifications by Email' == 'Never' + +|waiting| **Waiting**: Waiting to be sent + +|error| **Error**: Error while sending + +|sent| **Sent**: Sent to SMTP server configured + +|delivered| **Delivered**: Delivered to final MX server + +|opened| **Opened**: Opened by partner + +|cc| **Cc**: It's a Carbon-Copy recipient. Can't know the status so is 'Unknown' diff --git a/mail_tracking/static/description/index.html b/mail_tracking/static/description/index.html new file mode 100644 index 000000000..1d4556947 --- /dev/null +++ b/mail_tracking/static/description/index.html @@ -0,0 +1,457 @@ + + + + + + +Email tracking + + + +
+

Email tracking

+ + +

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

+

This module shows email notification tracking status for any messages in +mail thread (chatter). Each notified partner will have an intuitive icon just +right to his name.

+

Table of contents

+ +
+

Installation

+

If you’re using a multi-database installation (with or without dbfilter option) +where /web/databse/selector returns a list of more than one database, then +you need to add mail_tracking addon to wide load addons list +(by default, only web addon), setting --load option. +For example, --load=web,mail_tracking

+
+
+

Usage

+

If you want to see all tracking emails and events you can go to

+
    +
  • Settings > Technical > Email > Tracking emails
  • +
  • Settings > Technical > Email > Tracking events
  • +
+

When user sends a message in mail_thread (chatter), for instance in partner +form, then an email tracking is created for each email notification. Then a +status icon will appear just right to name of notified partner.

+

These are all available status icons:

+

unknown Unknown: No email tracking info available. Maybe this notified partner has ‘Receive Inbox Notifications by Email’ == ‘Never’

+

waiting Waiting: Waiting to be sent

+

error Error: Error while sending

+

sent Sent: Sent to SMTP server configured

+

delivered Delivered: Delivered to final MX server

+

opened Opened: Opened by partner

+

cc Cc: It’s a Carbon-Copy recipient. Can’t know the status so is ‘Unknown’

+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

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_tracking/static/src/img/cc.png b/mail_tracking/static/src/img/cc.png new file mode 100644 index 000000000..32d45051a Binary files /dev/null and b/mail_tracking/static/src/img/cc.png differ diff --git a/mail_tracking/static/src/js/mail_tracking.js b/mail_tracking/static/src/js/mail_tracking.js index a06da95e9..25abcd345 100644 --- a/mail_tracking/static/src/js/mail_tracking.js +++ b/mail_tracking/static/src/js/mail_tracking.js @@ -2,35 +2,35 @@ Copyright 2018 David Vidal - License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ -odoo.define('mail_tracking.partner_tracking', function(require){ +odoo.define('mail_tracking.partner_tracking', function (require) { "use strict"; var core = require('web.core'); - var session = require('web.session'); - var data = require('web.data'); var ActionManager = require('web.ActionManager'); var chat_manager = require('mail.chat_manager'); var ChatThread = require('mail.ChatThread'); - var Chatter = require('mail.Chatter'); var _t = core._t; - // chat_manager is a simple dictionary, not an OdooClass + // Chat_manager is a simple dictionary, not an OdooClass chat_manager._make_message_super = chat_manager.make_message; - chat_manager.make_message = function(data) { + chat_manager.make_message = function (data) { var msg = this._make_message_super(data); msg.partner_trackings = data.partner_trackings || []; + msg.email_cc = data.email_cc || []; return msg; }; ChatThread.include({ events: _.extend(ChatThread.prototype.events, { - 'click .o_mail_action_tracking_partner': 'on_tracking_partner_click', + 'click .o_mail_action_tracking_partner': + 'on_tracking_partner_click', 'click .o_mail_action_tracking_status': 'on_tracking_status_click', }), - _preprocess_message: function (message) { + _preprocess_message: function () { var msg = this._super.apply(this, arguments); msg.partner_trackings = msg.partner_trackings || []; + msg.email_cc = msg.email_cc || []; return msg; }, on_tracking_partner_click: function (event) { @@ -73,9 +73,9 @@ odoo.define('mail_tracking.partner_tracking', function(require){ }; this.do_action(action); }, - init: function (parent, options) { + init: function () { this._super.apply(this, arguments); - this.action_manager = this.findAncestor(function(ancestor){ + this.action_manager = this.findAncestor(function (ancestor) { return ancestor instanceof ActionManager; }); }, diff --git a/mail_tracking/static/src/xml/mail_tracking.xml b/mail_tracking/static/src/xml/mail_tracking.xml index 5bc278da9..41e102370 100644 --- a/mail_tracking/static/src/xml/mail_tracking.xml +++ b/mail_tracking/static/src/xml/mail_tracking.xml @@ -1,37 +1,43 @@