[MIG] mail_tracking: Adapt Cc to 12.0

This commit is contained in:
Alexandre Díaz 2019-07-03 11:12:11 +02:00 committed by Jasmin Solanki
parent c2fd8c95fc
commit 6513662533
9 changed files with 119 additions and 13 deletions

View File

@ -23,7 +23,7 @@ Email tracking
:target: https://runbot.odoo-community.org/runbot/205/12.0 :target: https://runbot.odoo-community.org/runbot/205/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module shows email notification tracking status for any messages in This module shows email notification tracking status for any messages in
mail thread (chatter). Each notified partner will have an intuitive icon just mail thread (chatter). Each notified partner will have an intuitive icon just
@ -70,6 +70,9 @@ These are all available status icons:
.. |unknown| image:: mail_tracking/static/src/img/unknown.png .. |unknown| image:: mail_tracking/static/src/img/unknown.png
:width: 10px :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' |unknown| **Unknown**: No email tracking info available. Maybe this notified partner has 'Receive Inbox Notifications by Email' == 'Never'
|waiting| **Waiting**: Waiting to be sent |waiting| **Waiting**: Waiting to be sent
@ -82,12 +85,14 @@ These are all available status icons:
|opened| **Opened**: Opened by partner |opened| **Opened**: Opened by partner
|cc| **Cc**: It's a Carbon-Copy recipient. Can't know the status so is 'Unknown'
If you want to see all tracking emails and events you can go to If you want to see all tracking emails and events you can go to
* Settings > Technical > Email > Tracking emails * Settings > Technical > Email > Tracking emails
* Settings > Technical > Email > Tracking events * Settings > Technical > Email > Tracking events
Bug Tracker Bug Tracker
=========== ===========
@ -116,6 +121,7 @@ Contributors
* David Vidal * David Vidal
* Ernesto Tejeda * Ernesto Tejeda
* Rafael Blasco * Rafael Blasco
* Alexandre Díaz
Other credits Other credits
~~~~~~~~~~~~~ ~~~~~~~~~~~~~

View File

@ -27,6 +27,12 @@ msgid " * The 'Error' status indicates that there was an error when trying to se
"" ""
msgstr "" 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 #. module: mail_tracking
#: model_terms:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_event_search #: model_terms:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_event_search
msgid "Bounce" msgid "Bounce"
@ -47,6 +53,15 @@ msgstr ""
msgid "Bounced" msgid "Bounced"
msgstr "" 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 #. module: mail_tracking
#: model_terms:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_event_search #: model_terms:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_event_search
msgid "Click" msgid "Click"
@ -143,6 +158,11 @@ msgstr ""
msgid "Email Score" msgid "Email Score"
msgstr "" msgstr ""
#. module: mail_tracking
#: model:ir.model,name:mail_tracking.model_mail_thread
msgid "Email Thread"
msgstr ""
#. module: mail_tracking #. module: mail_tracking
#: model_terms:ir.ui.view,arch_db:mail_tracking.view_res_partner_filter #: model_terms:ir.ui.view,arch_db:mail_tracking.view_res_partner_filter
msgid "Email bounced" msgid "Email bounced"
@ -288,7 +308,7 @@ msgstr ""
#. module: mail_tracking #. module: mail_tracking
#. openerp-web #. openerp-web
#: code:addons/mail_tracking/static/src/js/mail_tracking.js:88 #: code:addons/mail_tracking/static/src/js/mail_tracking.js:126
#, python-format #, python-format
msgid "Message tracking" msgid "Message tracking"
msgstr "" msgstr ""
@ -403,6 +423,13 @@ msgstr ""
msgid "State" msgid "State"
msgstr "" msgstr ""
#. module: mail_tracking
#. openerp-web
#: code:addons/mail_tracking/static/src/xml/mail_tracking.xml:96
#, python-format
msgid "Status: unknown"
msgstr ""
#. module: mail_tracking #. module: mail_tracking
#: model:ir.model.fields,field_description:mail_tracking.field_mail_tracking_email__name #: model:ir.model.fields,field_description:mail_tracking.field_mail_tracking_email__name
#: model_terms:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_email_search #: model_terms:ir.ui.view,arch_db:mail_tracking.view_mail_tracking_email_search
@ -419,7 +446,7 @@ msgstr ""
#. module: mail_tracking #. module: mail_tracking
#. openerp-web #. openerp-web
#: code:addons/mail_tracking/static/src/xml/mail_tracking.xml:47 #: code:addons/mail_tracking/static/src/xml/mail_tracking.xml:53
#, python-format #, python-format
msgid "To:" msgid "To:"
msgstr "" msgstr ""
@ -445,7 +472,7 @@ msgstr ""
#. module: mail_tracking #. module: mail_tracking
#. openerp-web #. openerp-web
#: code:addons/mail_tracking/static/src/js/mail_tracking.js:68 #: code:addons/mail_tracking/static/src/js/mail_tracking.js:106
#, python-format #, python-format
msgid "Tracking partner" msgid "Tracking partner"
msgstr "" msgstr ""

View File

@ -4,6 +4,7 @@
import time import time
from datetime import datetime from datetime import datetime
from email.utils import COMMASPACE from email.utils import COMMASPACE
from odoo import models, fields from odoo import models, fields

View File

@ -106,7 +106,8 @@ class MailMessage(models.Model):
for message_dict in messages: for message_dict in messages:
mail_message_id = message_dict.get('id', False) mail_message_id = message_dict.get('id', False)
if mail_message_id: if mail_message_id:
message_dict['partner_trackings'] = \ message_dict.update({
partner_trackings[mail_message_id] 'partner_trackings': partner_trackings[mail_message_id],
message_dict['email_cc'] = email_cc[mail_message_id] 'email_cc': email_cc[mail_message_id],
})
return res return res

View File

@ -5,3 +5,4 @@
* David Vidal * David Vidal
* Ernesto Tejeda * Ernesto Tejeda
* Rafael Blasco * Rafael Blasco
* Alexandre Díaz

View File

@ -22,6 +22,9 @@ These are all available status icons:
.. |unknown| image:: mail_tracking/static/src/img/unknown.png .. |unknown| image:: mail_tracking/static/src/img/unknown.png
:width: 10px :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' |unknown| **Unknown**: No email tracking info available. Maybe this notified partner has 'Receive Inbox Notifications by Email' == 'Never'
|waiting| **Waiting**: Waiting to be sent |waiting| **Waiting**: Waiting to be sent
@ -34,8 +37,10 @@ These are all available status icons:
|opened| **Opened**: Opened by partner |opened| **Opened**: Opened by partner
|cc| **Cc**: It's a Carbon-Copy recipient. Can't know the status so is 'Unknown'
If you want to see all tracking emails and events you can go to If you want to see all tracking emails and events you can go to
* Settings > Technical > Email > Tracking emails * Settings > Technical > Email > Tracking emails
* Settings > Technical > Email > Tracking events * Settings > Technical > Email > Tracking events

View File

@ -409,6 +409,7 @@ status icon will appear just right to name of notified partner.</p>
<p><img alt="sent" src="mail_tracking/static/src/img/sent.png" style="width: 10px;" /> <strong>Sent</strong>: Sent to SMTP server configured</p> <p><img alt="sent" src="mail_tracking/static/src/img/sent.png" style="width: 10px;" /> <strong>Sent</strong>: Sent to SMTP server configured</p>
<p><img alt="delivered" src="mail_tracking/static/src/img/delivered.png" style="width: 15px;" /> <strong>Delivered</strong>: Delivered to final MX server</p> <p><img alt="delivered" src="mail_tracking/static/src/img/delivered.png" style="width: 15px;" /> <strong>Delivered</strong>: Delivered to final MX server</p>
<p><img alt="opened" src="mail_tracking/static/src/img/opened.png" style="width: 15px;" /> <strong>Opened</strong>: Opened by partner</p> <p><img alt="opened" src="mail_tracking/static/src/img/opened.png" style="width: 15px;" /> <strong>Opened</strong>: Opened by partner</p>
<p><img alt="cc" src="static/src/img/cc.png" style="width: 10px;" /> <strong>Cc</strong>: Its a Carbon-Copy recipient. Cant know the status so is Unknown</p>
<p>If you want to see all tracking emails and events you can go to</p> <p>If you want to see all tracking emails and events you can go to</p>
<ul class="simple"> <ul class="simple">
<li>Settings &gt; Technical &gt; Email &gt; Tracking emails</li> <li>Settings &gt; Technical &gt; Email &gt; Tracking emails</li>
@ -440,6 +441,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>David Vidal</li> <li>David Vidal</li>
<li>Ernesto Tejeda</li> <li>Ernesto Tejeda</li>
<li>Rafael Blasco</li> <li>Rafael Blasco</li>
<li>Alexandre Díaz</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -28,6 +28,7 @@ odoo.define('mail_tracking.partner_tracking', function(require){
init: function (parent, data, emojis) { init: function (parent, data, emojis) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this._partnerTrackings = data.partner_trackings || []; this._partnerTrackings = data.partner_trackings || [];
this._emailCc = data.email_cc || [];
}, },
/** /**
@ -37,7 +38,16 @@ odoo.define('mail_tracking.partner_tracking', function(require){
* @return {boolean} * @return {boolean}
*/ */
hasPartnerTrackings: function () { hasPartnerTrackings: function () {
return !!(this._partnerTrackings && (this._partnerTrackings.length > 0)); return _.some(this._partnerTrackings);
},
/**
* State whether this message contains some email Cc values
*
* @return {boolean}
*/
hasEmailCc: function () {
return _.some(this._emailCc);
}, },
/** /**
@ -53,6 +63,34 @@ odoo.define('mail_tracking.partner_tracking', function(require){
} }
return this._partnerTrackings; return this._partnerTrackings;
}, },
/**
* Get the email Cc values of this message
* If this message has no email Cc values, returns []
*
* @return {Array}
*/
getEmailCc: function () {
if (!this.hasEmailCc()) {
return [];
}
return this._emailCc;
},
/**
* Check if the email is an Cc
* If this message has no email Cc values, returns false
*
* @return {Boolean}
*/
isEmailCc: function (email) {
if (!this.hasEmailCc()) {
return false;
}
return _.some(this._emailCc, function (item) {
return item[0] === email;
});
},
}); });
ThreadWidget.include({ ThreadWidget.include({

View File

@ -48,16 +48,17 @@
<t t-extend="mail.widget.Thread.Message"> <t t-extend="mail.widget.Thread.Message">
<t t-jquery="p.o_mail_info" t-operation="after"> <t t-jquery="p.o_mail_info" t-operation="after">
<t t-if="message.hasPartnerTrackings()" > <t t-if="message.hasPartnerTrackings() || message.hasEmailCc()" >
<p class="o_mail_tracking"> <p class="o_mail_tracking">
<strong>To:</strong> <strong>To:</strong>
<t t-set="first_tracking" t-value="true"/> <t t-set="first_tracking" t-value="true"/>
<t t-foreach="message.getPartnerTrackings()" t-as="tracking"> <t t-foreach="message.getPartnerTrackings()" t-as="tracking">
<t t-set="isCc" t-value="message.isEmailCc(tracking[4])" />
<t t-if="!first_tracking"> <t t-if="!first_tracking">
- -
</t> </t>
<t t-if="tracking[3]"> <t t-if="tracking[3]">
<a class="o_mail_action_tracking_partner" <a t-attf-class="o_mail_action_tracking_partner #{isCc ? 'o_mail_cc' : ''}"
t-att-data-partner="tracking[3]" t-att-data-partner="tracking[3]"
t-attf-href="#model=res.partner&amp;id=#{tracking[3]}"> t-attf-href="#model=res.partner&amp;id=#{tracking[3]}">
<t t-esc="tracking[2]"/> <t t-esc="tracking[2]"/>
@ -73,6 +74,30 @@
</span> </span>
<t t-set="first_tracking" t-value="false"/> <t t-set="first_tracking" t-value="false"/>
</t> </t>
<t t-foreach="message.getEmailCc()" t-as="cc">
<t t-set="needPrint" t-value="true" />
<t t-foreach="message.getPartnerTrackings()" t-as="tracking">
<t t-if="cc[0] == tracking[4]" t-set="needPrint" t-value="false" />
</t>
<t t-if="needPrint">
<t t-set="isCc" t-value="true" />
<t t-if="cc[1]">
<a t-attf-class="o_mail_action_tracking_partner o_mail_cc"
t-att-data-partner="cc[1][0]"
t-attf-href="#model=res.partner&amp;id=#{cc[1][0]}">
<t t-esc="cc[1][1]"/>
</a>
</t>
<t t-else="">
<span class="o_mail_cc"><t t-esc="cc[0]" /></span>
</t>
<span class="mail_tracking"
title="Status: unknown">
<t t-call="mail.tracking.status"/>
</span>
</t>
</t>
</p> </p>
</t> </t>
</t> </t>