diff options
| -rw-r--r-- | addons/link_tracker/models/link_tracker.py | 1 | ||||
| -rw-r--r-- | addons/link_tracker/views/link_tracker_views.xml | 2 | ||||
| -rw-r--r-- | addons/mass_mailing/models/mailing.py | 18 |
3 files changed, 15 insertions, 6 deletions
diff --git a/addons/link_tracker/models/link_tracker.py b/addons/link_tracker/models/link_tracker.py index 8ea1a04f50e..925c613c0c6 100644 --- a/addons/link_tracker/models/link_tracker.py +++ b/addons/link_tracker/models/link_tracker.py @@ -22,6 +22,7 @@ class LinkTracker(models.Model): _name = "link.tracker" _rec_name = "short_url" _description = "Link Tracker" + _order="count DESC" _inherit = ["utm.mixin"] # URL info diff --git a/addons/link_tracker/views/link_tracker_views.xml b/addons/link_tracker/views/link_tracker_views.xml index 75336bc79d3..40c4d75d593 100644 --- a/addons/link_tracker/views/link_tracker_views.xml +++ b/addons/link_tracker/views/link_tracker_views.xml @@ -62,7 +62,7 @@ <field name="url"/> <field name="short_url" optional="hide"/> <field name="count"/> - <button name="action_visit_page" type="object" string="Visit Page" icon="fa-external-link"/> + <button name="action_visit_page" type="object" string="Visit Page" icon="fa-external-link"/> </tree> </field> </record> 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) |
