diff options
| author | std-odoo <std@odoo.com> | 2020-04-17 07:37:45 +0000 |
|---|---|---|
| committer | Debauche Stéphane <std@odoo.com> | 2020-06-12 11:49:45 +0000 |
| commit | b16843230d9c62606550c061934f319fee23d3c5 (patch) | |
| tree | 2b7608860889186fffa902ae2cf9cbb466d4281f /addons/link_tracker/models/link_tracker.py | |
| parent | 5227f956da1b64293f3e1301ff03b4efb28db80b (diff) | |
[IMP] mass_mailing: send a statistics email to the mailing responsible
Purpose
=======
Provide a follow-up/overview of the Mailing 24 hours after its been sent.
Specifications
==============
Send an email to the responsible of the mailing 24 hours the last email
of the mass mailing.
During the link trackers creation, extract the button label if exists
(so we can display them in the statistics email).
Technical remarks
=================
The statistics email is sent to the responsible of each mailing in the
CRON of mass mailing.
Task-2227411
closes odoo/odoo#49836
Related: odoo/upgrade#1094
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/link_tracker/models/link_tracker.py')
| -rw-r--r-- | addons/link_tracker/models/link_tracker.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/addons/link_tracker/models/link_tracker.py b/addons/link_tracker/models/link_tracker.py index 925c613c0c6..2ee2fad31ab 100644 --- a/addons/link_tracker/models/link_tracker.py +++ b/addons/link_tracker/models/link_tracker.py @@ -27,16 +27,28 @@ class LinkTracker(models.Model): # URL info url = fields.Char(string='Target URL', required=True) + absolute_url = fields.Char("Absolute URL", compute="_compute_absolute_url") short_url = fields.Char(string='Tracked URL', compute='_compute_short_url') redirected_url = fields.Char(string='Redirected URL', compute='_compute_redirected_url') short_url_host = fields.Char(string='Host of the short URL', compute='_compute_short_url_host') title = fields.Char(string='Page Title', store=True) + label = fields.Char(string='Button label') # Tracking link_code_ids = fields.One2many('link.tracker.code', 'link_id', string='Codes') code = fields.Char(string='Short URL code', compute='_compute_code') link_click_ids = fields.One2many('link.tracker.click', 'link_id', string='Clicks') count = fields.Integer(string='Number of Clicks', compute='_compute_count', store=True) + @api.depends("url") + def _compute_absolute_url(self): + web_base_url = urls.url_parse(self.env['ir.config_parameter'].sudo().get_param('web.base.url')) + for tracker in self: + url = urls.url_parse(tracker.url) + if url.scheme: + tracker.absolute_url = tracker.url + else: + tracker.absolute_url = web_base_url.join(url).to_url() + @api.depends('link_click_ids.link_id') def _compute_count(self): if self.ids: @@ -99,9 +111,11 @@ class LinkTracker(models.Model): else: create_vals['url'] = tools.validate_url(vals['url']) - search_domain = [] - for fname, value in create_vals.items(): - search_domain.append((fname, '=', value)) + search_domain = [ + (fname, '=', value) + for fname, value in create_vals.items() + if fname in ['url', 'campaign_id', 'medium_id', 'source_id'] + ] result = self.search(search_domain, limit=1) |
