diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-02-11 12:20:39 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-21 12:28:52 +0000 |
| commit | 3f6625ef134c35ad8fab00ca99b451a7dfabee08 (patch) | |
| tree | 1fd4dbc9de252a887fe91ed5b1cc7780bea6025a /addons/mass_mailing/models/mailing.py | |
| parent | 2457e7f6f45b23118ce73c47112d60802411cc4b (diff) | |
[IMP] link_tracker, mass_mailing: uuse read_group instead of computing len of one2many fields
PURPOSE
Several counter fields are performed inefficiently. They use compute methods
using length of 2many fields instead of making use of more efficient ORM
methods like read_group.
SPECIFICATIONS
There may be a lot of clicks linked to a given link tracker. Compute the count
of clicks in batch with a read_group to improve performance.
Same for utm campaign mailing count performances.
Some missing indexes are added to speedup queries.
LINKS
Task ID 2196182
PR #44662
Co-Authored-By: Victor Feyens <vfe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
Diffstat (limited to 'addons/mass_mailing/models/mailing.py')
| -rw-r--r-- | addons/mass_mailing/models/mailing.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 2446c03dd0a..e644f4b0d7c 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -65,7 +65,7 @@ class MassMailing(models.Model): attachment_ids = fields.Many2many('ir.attachment', 'mass_mailing_ir_attachments_rel', 'mass_mailing_id', 'attachment_id', string='Attachments') keep_archives = fields.Boolean(string='Keep Archives') - campaign_id = fields.Many2one('utm.campaign', string='UTM Campaign') + campaign_id = fields.Many2one('utm.campaign', string='UTM Campaign', index=True) source_id = fields.Many2one('utm.source', string='Source', required=True, ondelete='cascade', help="This is the link source, e.g. Search Engine, another domain, or name of email list") medium_id = fields.Many2one( |
