mirror of https://github.com/OCA/social.git
[MIG] mail_tracking: Adapt Cc to 12.0
parent
61a719d861
commit
c36b61b1a1
|
@ -23,7 +23,7 @@ Email tracking
|
|||
:target: https://runbot.odoo-community.org/runbot/205/12.0
|
||||
: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
|
||||
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
|
||||
: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
|
||||
|
@ -82,12 +85,14 @@ These are all available status icons:
|
|||
|
||||
|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
|
||||
|
||||
* Settings > Technical > Email > Tracking emails
|
||||
* Settings > Technical > Email > Tracking events
|
||||
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
|
@ -116,6 +121,7 @@ Contributors
|
|||
* David Vidal
|
||||
* Ernesto Tejeda
|
||||
* Rafael Blasco
|
||||
* Alexandre Díaz
|
||||
|
||||
Other credits
|
||||
~~~~~~~~~~~~~
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import time
|
||||
from datetime import datetime
|
||||
from email.utils import COMMASPACE
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
|
|
|
@ -106,7 +106,8 @@ class MailMessage(models.Model):
|
|||
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]
|
||||
message_dict.update({
|
||||
'partner_trackings': partner_trackings[mail_message_id],
|
||||
'email_cc': email_cc[mail_message_id],
|
||||
})
|
||||
return res
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
* David Vidal
|
||||
* Ernesto Tejeda
|
||||
* Rafael Blasco
|
||||
* Alexandre Díaz
|
||||
|
|
|
@ -22,6 +22,9 @@ These are all available status icons:
|
|||
.. |unknown| image:: mail_tracking/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
|
||||
|
@ -34,8 +37,10 @@ These are all available status icons:
|
|||
|
||||
|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
|
||||
|
||||
* Settings > Technical > Email > Tracking emails
|
||||
* Settings > Technical > Email > Tracking events
|
||||
|
||||
|
|
|
@ -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="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="cc" src="static/src/img/cc.png" style="width: 10px;" /> <strong>Cc</strong>: It’s a Carbon-Copy recipient. Can’t know the status so is ‘Unknown’</p>
|
||||
<p>If you want to see all tracking emails and events you can go to</p>
|
||||
<ul class="simple">
|
||||
<li>Settings > Technical > Email > 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>Ernesto Tejeda</li>
|
||||
<li>Rafael Blasco</li>
|
||||
<li>Alexandre Díaz</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -28,6 +28,7 @@ odoo.define('mail_tracking.partner_tracking', function(require){
|
|||
init: function (parent, data, emojis) {
|
||||
this._super.apply(this, arguments);
|
||||
this._partnerTrackings = data.partner_trackings || [];
|
||||
this._emailCc = data.email_cc || [];
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -37,7 +38,16 @@ odoo.define('mail_tracking.partner_tracking', function(require){
|
|||
* @return {boolean}
|
||||
*/
|
||||
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;
|
||||
},
|
||||
|
||||
/**
|
||||
* 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({
|
||||
|
|
|
@ -48,16 +48,17 @@
|
|||
|
||||
<t t-extend="mail.widget.Thread.Message">
|
||||
<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">
|
||||
<strong>To:</strong>
|
||||
<t t-set="first_tracking" t-value="true"/>
|
||||
<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 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-attf-href="#model=res.partner&id=#{tracking[3]}">
|
||||
<t t-esc="tracking[2]"/>
|
||||
|
@ -73,6 +74,30 @@
|
|||
</span>
|
||||
<t t-set="first_tracking" t-value="false"/>
|
||||
</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&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>
|
||||
</t>
|
||||
</t>
|
||||
|
|
Loading…
Reference in New Issue