summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/models/mailing.py
diff options
context:
space:
mode:
authorSébastien Mottet (oms) <oms@odoo.com>2020-04-20 09:24:34 +0000
committerThibault Delavallée <tde@odoo.com>2020-05-27 11:00:29 +0000
commitfd87ff484399b40004b25f4502c631fd1fc5ea7c (patch)
treef8a648b4c93a4a2d42cedae91f3882003de20381 /addons/mass_mailing/models/mailing.py
parent60e4e9912a0ceb039019186736f28fe3be17ede6 (diff)
[IMP] mass_mailing(_sms): "Click" stat button now redirects to link trackers
PURPOSE Clarify the use case in which a specified email address is set as replies may not be traceable. Make the %Click KPIs visible for Emails as well. Allow users to report on the links that have (or not) been clicked from their mailing. SPECIFICATIONS Display list of link trackers linked to the mailing on 'click' stat button click. Task ID: 2202495 PR #48339 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/mass_mailing/models/mailing.py')
-rw-r--r--addons/mass_mailing/models/mailing.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py
index 172302f21eb..38814270ae1 100644
--- a/addons/mass_mailing/models/mailing.py
+++ b/addons/mass_mailing/models/mailing.py
@@ -72,7 +72,6 @@ class MassMailing(models.Model):
'utm.medium', string='Medium',
compute='_compute_medium_id', readonly=False, store=True,
help="UTM Medium: delivery method (email, sms, ...)")
- clicks_ratio = fields.Integer(compute="_compute_clicks_ratio", string="Number of Clicks")
state = fields.Selection([('draft', 'Draft'), ('in_queue', 'In Queue'), ('sending', 'Sending'), ('done', 'Sent')],
string='Status', required=True, tracking=True, copy=False, default='draft', group_expand='_group_expand_states')
color = fields.Integer(string='Color Index')
@@ -126,6 +125,7 @@ class MassMailing(models.Model):
opened_ratio = fields.Integer(compute="_compute_statistics", string='Opened Ratio')
replied_ratio = fields.Integer(compute="_compute_statistics", string='Replied Ratio')
bounced_ratio = fields.Integer(compute="_compute_statistics", string='Bounced Ratio')
+ clicks_ratio = fields.Integer(compute="_compute_clicks_ratio", string="Number of Clicks")
next_departure = fields.Datetime(compute="_compute_next_departure", string='Scheduled date')
def _compute_total(self):
@@ -326,6 +326,17 @@ class MassMailing(models.Model):
action['context'][filter_key] = True
return action
+ def action_view_clicked(self):
+ model_name = self.env['ir.model']._get('link.tracker').display_name
+ return {
+ 'name': model_name,
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'tree',
+ 'res_model': 'link.tracker',
+ 'domain': [('mass_mailing_id.id', '=', self.id)],
+ 'context': dict(self._context, create=False)
+ }
+
def action_view_opened(self):
return self._action_view_documents_filtered('opened')
@@ -335,14 +346,11 @@ class MassMailing(models.Model):
def action_view_bounced(self):
return self._action_view_documents_filtered('bounced')
- def action_view_clicked(self):
- return self._action_view_documents_filtered('clicked')
-
def action_view_delivered(self):
return self._action_view_documents_filtered('delivered')
def _action_view_documents_filtered(self, view_filter):
- if view_filter in ('opened', 'replied', 'bounced', 'clicked'):
+ if view_filter in ('opened', 'replied', 'bounced'):
opened_stats = self.mailing_trace_ids.filtered(lambda stat: stat[view_filter])
elif view_filter == ('delivered'):
opened_stats = self.mailing_trace_ids.filtered(lambda stat: stat.sent and not stat.bounced)