summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirti Choudhary <kic@odoo.com>2017-07-19 18:56:18 +0530
committerYannick Tivisse <yti@odoo.com>2018-02-06 06:36:05 +0100
commitbacc043fb5abca41f5439c25fb6acedeeb42405b (patch)
tree9bbb136898ca35261beed8635157004199900f77
parent3b8ba47f1144644cf1a35fcaa5950841027377da (diff)
[IMP] mass_mailing: Display the number of clicks on reporting
Purpose ======= On the pivot table for reporting on mass mailing you have all the options on the individual mass mailing, except clicks. This stat is however available in mass mail form Secification ============ Add 'Clicks' in pivot table reporting view
-rw-r--r--addons/mass_mailing/models/mass_mailing.py3
-rw-r--r--addons/mass_mailing/models/mass_mailing_report.py2
-rw-r--r--addons/mass_mailing/views/mass_mailing_report_views.xml1
3 files changed, 6 insertions, 0 deletions
diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py
index 3c7480abfb2..3d082070280 100644
--- a/addons/mass_mailing/models/mass_mailing.py
+++ b/addons/mass_mailing/models/mass_mailing.py
@@ -414,6 +414,7 @@ class MassMailing(models.Model):
sent = fields.Integer(compute="_compute_statistics")
delivered = fields.Integer(compute="_compute_statistics")
opened = fields.Integer(compute="_compute_statistics")
+ clicked = fields.Integer(compute="_compute_statistics")
replied = fields.Integer(compute="_compute_statistics")
bounced = fields.Integer(compute="_compute_statistics")
failed = fields.Integer(compute="_compute_statistics")
@@ -457,6 +458,7 @@ class MassMailing(models.Model):
COUNT(CASE WHEN s.scheduled is not null AND s.sent is null AND s.exception is not null THEN 1 ELSE null END) AS failed,
COUNT(CASE WHEN s.sent is not null AND s.bounced is null THEN 1 ELSE null END) AS delivered,
COUNT(CASE WHEN s.opened is not null THEN 1 ELSE null END) AS opened,
+ COUNT(CASE WHEN s.clicked is not null THEN 1 ELSE null END) AS clicked,
COUNT(CASE WHEN s.replied is not null THEN 1 ELSE null END) AS replied,
COUNT(CASE WHEN s.bounced is not null THEN 1 ELSE null END) AS bounced,
COUNT(CASE WHEN s.exception is not null THEN 1 ELSE null END) AS failed
@@ -474,6 +476,7 @@ class MassMailing(models.Model):
total = row.pop('total') or 1
row['received_ratio'] = 100.0 * row['delivered'] / total
row['opened_ratio'] = 100.0 * row['opened'] / total
+ row['clicks_ratio'] = 100.0 * row['clicked'] / total
row['replied_ratio'] = 100.0 * row['replied'] / total
row['bounced_ratio'] = 100.0 * row['bounced'] / total
self.browse(row.pop('mailing_id')).update(row)
diff --git a/addons/mass_mailing/models/mass_mailing_report.py b/addons/mass_mailing/models/mass_mailing_report.py
index 0747fab18fb..13f8c873d6e 100644
--- a/addons/mass_mailing/models/mass_mailing_report.py
+++ b/addons/mass_mailing/models/mass_mailing_report.py
@@ -17,6 +17,7 @@ class MassMailingReport(models.Model):
opened = fields.Integer(readonly=True)
bounced = fields.Integer(readonly=True)
replied = fields.Integer(readonly=True)
+ clicked = fields.Integer(readonly=True)
state = fields.Selection([('draft', 'Draft'), ('test', 'Tested'), ('done', 'Sent')],
string='Status', readonly=True)
email_from = fields.Char('From', readonly=True)
@@ -39,6 +40,7 @@ class MassMailingReport(models.Model):
(count(ms.sent) - count(ms.bounced)) as delivered,
count(ms.opened) as opened,
count(ms.replied) as replied,
+ count(ms.clicked) as clicked,
mm.state,
mm.email_from
FROM
diff --git a/addons/mass_mailing/views/mass_mailing_report_views.xml b/addons/mass_mailing/views/mass_mailing_report_views.xml
index fea496263a3..cdf9bf7d936 100644
--- a/addons/mass_mailing/views/mass_mailing_report_views.xml
+++ b/addons/mass_mailing/views/mass_mailing_report_views.xml
@@ -11,6 +11,7 @@
<field name="opened" type="measure"/>
<field name="bounced" type="measure"/>
<field name="replied" type="measure"/>
+ <field name="clicked" type="measure"/>
</pivot>
</field>
</record>