[IMP] mail_tracking: translations

This commit is contained in:
Alexandre Díaz 2019-08-12 13:51:15 +02:00 committed by Jasmin Solanki
parent d3ddffb54b
commit 5ec699ab9a
2 changed files with 14 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# Copyright 2019 Alexandre Díaz # Copyright 2019 Alexandre Díaz
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, api, fields from odoo import _, models, api, fields
from odoo.tools import email_split from odoo.tools import email_split
@ -50,6 +50,12 @@ class MailMessage(models.Model):
status = tracking_status_map.get(tracking_email_status, 'unknown') status = tracking_status_map.get(tracking_email_status, 'unknown')
return status return status
def _partner_tracking_status_human_get(self, status):
statuses = {'waiting': _('Waiting'), 'error': _('Error'),
'sent': _('Sent'), 'delivered': _('Delivered'),
'opened': _('Opened'), 'unknown': _('Unknown')}
return _("Status: %s") % statuses[status]
def tracking_status(self): def tracking_status(self):
res = {} res = {}
for message in self: for message in self:
@ -71,6 +77,8 @@ class MailMessage(models.Model):
tracking.partner_id.name or tracking.recipient) tracking.partner_id.name or tracking.recipient)
partner_trackings.append({ partner_trackings.append({
'status': status, 'status': status,
'status_human':
self._partner_tracking_status_human_get(status),
'tracking_id': tracking.id, 'tracking_id': tracking.id,
'recipient': recipient, 'recipient': recipient,
'partner_id': tracking.partner_id.id, 'partner_id': tracking.partner_id.id,
@ -95,6 +103,8 @@ class MailMessage(models.Model):
isCc = True isCc = True
partner_trackings.append({ partner_trackings.append({
'status': 'unknown', 'status': 'unknown',
'status_human':
self._partner_tracking_status_human_get('unknown'),
'tracking_id': False, 'tracking_id': False,
'recipient': partner.name, 'recipient': partner.name,
'partner_id': partner.id, 'partner_id': partner.id,
@ -104,6 +114,8 @@ class MailMessage(models.Model):
# If there is Cc without partner # If there is Cc without partner
partner_trackings.append({ partner_trackings.append({
'status': 'unknown', 'status': 'unknown',
'status_human':
self._partner_tracking_status_human_get('unknown'),
'tracking_id': False, 'tracking_id': False,
'recipient': email, 'recipient': email,
'partner_id': False, 'partner_id': False,

View File

@ -67,7 +67,7 @@
</t> </t>
<span class="mail_tracking o_mail_action_tracking_status" <span class="mail_tracking o_mail_action_tracking_status"
t-att-data-tracking="tracking['tracking_id']" t-att-data-tracking="tracking['tracking_id']"
t-attf-title="Status: #{tracking['status']}"> t-att-title="tracking['status_human']">
<t t-call="mail.tracking.status"/> <t t-call="mail.tracking.status"/>
</span> </span>
</t> </t>