From 5ec699ab9a7ecce07a52239b419f85438f3fd5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Mon, 12 Aug 2019 13:51:15 +0200 Subject: [PATCH] [IMP] mail_tracking: translations --- mail_tracking/models/mail_message.py | 14 +++++++++++++- mail_tracking/static/src/xml/mail_tracking.xml | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mail_tracking/models/mail_message.py b/mail_tracking/models/mail_message.py index 8a4423b..f67def5 100644 --- a/mail_tracking/models/mail_message.py +++ b/mail_tracking/models/mail_message.py @@ -2,7 +2,7 @@ # Copyright 2019 Alexandre Díaz # 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 @@ -50,6 +50,12 @@ class MailMessage(models.Model): status = tracking_status_map.get(tracking_email_status, 'unknown') 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): res = {} for message in self: @@ -71,6 +77,8 @@ class MailMessage(models.Model): tracking.partner_id.name or tracking.recipient) partner_trackings.append({ 'status': status, + 'status_human': + self._partner_tracking_status_human_get(status), 'tracking_id': tracking.id, 'recipient': recipient, 'partner_id': tracking.partner_id.id, @@ -95,6 +103,8 @@ class MailMessage(models.Model): isCc = True partner_trackings.append({ 'status': 'unknown', + 'status_human': + self._partner_tracking_status_human_get('unknown'), 'tracking_id': False, 'recipient': partner.name, 'partner_id': partner.id, @@ -104,6 +114,8 @@ class MailMessage(models.Model): # If there is Cc without partner partner_trackings.append({ 'status': 'unknown', + 'status_human': + self._partner_tracking_status_human_get('unknown'), 'tracking_id': False, 'recipient': email, 'partner_id': False, diff --git a/mail_tracking/static/src/xml/mail_tracking.xml b/mail_tracking/static/src/xml/mail_tracking.xml index b8b66e3..3553d9f 100644 --- a/mail_tracking/static/src/xml/mail_tracking.xml +++ b/mail_tracking/static/src/xml/mail_tracking.xml @@ -67,7 +67,7 @@ + t-att-title="tracking['status_human']">