diff options
| author | Jérémy Hennecart <jeh@odoo.com> | 2020-03-23 08:19:51 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-05-29 09:48:40 +0000 |
| commit | c15f9efed009dd2168fd8296ad573e70e4bbbe52 (patch) | |
| tree | e3216e1a52cb63888c0b1c1fc778f1473f33b1f1 /addons/mass_mailing/models/mailing.py | |
| parent | ad828f40424192337017a899566d71992381b574 (diff) | |
[IMP] mass_mailing: add email marketing tour
PURPOSE
Improve the Email Marketing tour and onboarding to create a "wow effect" when
users test the app.
SPECIFICATIONS
Create a tour for mass_mailing to let user visit Odoo Email Marketing through
a simple mailing creation flow.
This require the following functional changes
* by default, if user chooses to contact mailing lists and there is a single
mailing list available, add it as default value for chosen list;
* create a master mailing list data containing the admin user so that he can
easily follow the tour and test the mailing application;
LINKS
Task ID 2194876
Community PR odoo/odoo#48259
Upgrade PR odoo/upgrade#983
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 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py index 38814270ae1..7b5b5e65954 100644 --- a/addons/mass_mailing/models/mailing.py +++ b/addons/mass_mailing/models/mailing.py @@ -9,10 +9,9 @@ import random import re import threading from ast import literal_eval -from base64 import b64encode from datetime import datetime -from odoo import api, fields, models, tools, _, SUPERUSER_ID +from odoo import api, fields, models, tools, _ from odoo.exceptions import UserError from odoo.osv import expression @@ -45,6 +44,16 @@ class MassMailing(models.Model): _rec_name = "subject" @api.model + def default_get(self, fields): + vals = super(MassMailing, self).default_get(fields) + if 'contact_list_ids' in fields and not vals.get('contact_list_ids') and vals.get('mailing_model_id'): + if vals.get('mailing_model_id') == self.env['ir.model']._get('mailing.list').id: + mailing_list = self.env['mailing.list'].search([], limit=2) + if len(mailing_list) == 1: + vals['contact_list_ids'] = [(6, 0, [mailing_list.id])] + return vals + + @api.model def _get_default_mail_server_id(self): server_id = self.env['ir.config_parameter'].sudo().get_param('mass_mailing.mail_server_id') try: |
