diff options
| author | laa <laa@odoo.com> | 2019-09-11 15:04:40 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-11-07 16:19:37 +0000 |
| commit | 72aa04984463db0b15770cbf26fd15dd9c2ccaee (patch) | |
| tree | 1cbd3b140dd9338a4a2f3e460cb552dd148487d8 /addons/mass_mailing/models/mailing.py | |
| parent | dc70fb35a104e260b40425fce23cba84b9770994 (diff) | |
[IMP] mail, mass_mailing: add dynamic placeholder mixin and use it in mailing and templates
PURPOSE
Upgrade the "mass_mailing" and "mass_mailing_sms" modules with a dynamic
placeholder generator as it already exists in "mail module" as depicted in
https://www.screencast.com/t/cnFA0gIY.
SPECIFICATIONS
As duplicated code already exists for that and that a third version of this
code has to be added, instead create a mixin for this dynamic placeholder
generator to avoid code duplication.
Thereby
* a mail.render mixin for the dynamic placeholder generator must be
created in mail;
* dynamic placeholder generator code present in mail.template.py must be
moved to that mixin and replaced by a simple inherit;
* use the mixin in
* mail templates: mail.template.py (mail module);
* mass mailings: mailing.py (mass_mailing module);
* sms templates: sms.template (mass_mailing_sms module);
In a near future, some code will be added in this mixin, notably the template
rendering that could be moved outside of mail.template core model and moved
in that rendering mixin.
LINKS
Task ID 2070612
PR #36722
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.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 019763ac20e..cd098b3a347 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -40,7 +40,7 @@ class MassMailing(models.Model): A mass mailing is an occurence of sending emails. """ _name = 'mailing.mailing' _description = 'Mass Mailing' - _inherit = [ 'mail.thread', 'mail.activity.mixin'] + _inherit = [ 'mail.thread', 'mail.activity.mixin', 'mail.render.mixin'] # number of periods for tracking mail_mail statistics _period_number = 6 _order = 'sent_date DESC' @@ -128,7 +128,7 @@ class MassMailing(models.Model): replied_ratio = fields.Integer(compute="_compute_statistics", string='Replied Ratio') bounced_ratio = fields.Integer(compute="_compute_statistics", string='Bounced Ratio') next_departure = fields.Datetime(compute="_compute_next_departure", string='Scheduled date') - + def _compute_total(self): for mass_mailing in self: mass_mailing.total = len(mass_mailing.sudo()._get_recipients()) |
