diff --git a/addons/mass_mailing/__manifest__.py b/addons/mass_mailing/__manifest__.py index 73ed0cc919d..9cb082042d6 100644 --- a/addons/mass_mailing/__manifest__.py +++ b/addons/mass_mailing/__manifest__.py @@ -17,6 +17,7 @@ 'web_editor', 'web_kanban_gauge', 'social_media', + 'web_tour', ], 'data': [ 'security/mass_mailing_security.xml', diff --git a/addons/mass_mailing/data/mass_mailing_data.xml b/addons/mass_mailing/data/mass_mailing_data.xml index 5fb229f9971..95d6efc0fde 100644 --- a/addons/mass_mailing/data/mass_mailing_data.xml +++ b/addons/mass_mailing/data/mass_mailing_data.xml @@ -13,5 +13,13 @@ -1 + + Newsletter + + + + + + diff --git a/addons/mass_mailing/data/mass_mailing_demo.xml b/addons/mass_mailing/data/mass_mailing_demo.xml index bb4a942bbff..34e72a7418b 100644 --- a/addons/mass_mailing/data/mass_mailing_demo.xml +++ b/addons/mass_mailing/data/mass_mailing_demo.xml @@ -7,26 +7,21 @@ SampleDoc.doc - - - Imported Contacts - - Aristide Antario aa@example.com - + Beverly Bridge bb@example.com - + Carol Cartridge cc@example.com - + David Dawson @@ -35,12 +30,12 @@ Elsa Ericson ee@example.com - + - + True 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 @@ -44,6 +43,16 @@ class MassMailing(models.Model): _inherits = {'utm.source': 'source_id'} _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') diff --git a/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js b/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js new file mode 100644 index 00000000000..82d875e6839 --- /dev/null +++ b/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js @@ -0,0 +1,87 @@ +odoo.define('mass_mailing.mass_mailing_tour', function (require) { + "use strict"; + + var core = require('web.core'); + var _t = core._t; + var tour = require('web_tour.tour'); + var now = moment(); + + tour.register('mass_mailing_tour', { + url: '/web', + rainbowManMessage: _t('Congratulations, I love your first mailing. :)'), + }, [tour.stepUtils.showAppsMenuItem(), { + trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', + content: _t("Let's try the Email Marketing app."), + width: 210, + position: 'bottom', + edition: 'enterprise', + }, { + trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', + content: _t("Let's try the Email Marketing app."), + edition: 'community', + }, { + trigger: '.o-kanban-button-new', + content: _t("Start by creating your first Mailing."), + position: 'bottom', + }, { + trigger: 'input[name="subject"]', + content: _t('Pick the email subject.'), + position: 'right', + run: 'text ' + now.format("MMMM") + " Newsletter", + }, { + trigger: 'div[name="contact_list_ids"] > .o_input_dropdown > input[type="text"]', + run: 'click', + auto: true, + }, { + trigger: 'li.ui-menu-item', + run: 'click', + auto: true, + }, { + trigger: 'div[name="body_arch"] iframe #newsletter', + content: _t('Choose this theme.'), + position: 'left', + edition: 'enterprise', + run: 'click', + }, { + trigger: 'div[name="body_arch"] iframe #default', + content: _t('Choose this theme.'), + position: 'right', + edition: 'community', + run: 'click', + }, { + trigger: 'div[name="body_arch"] iframe div.o_mail_block_paragraph', + content: _t('Click on this paragraph to edit it.'), + position: 'top', + edition: 'enterprise', + run: 'click', + }, { + trigger: 'div[name="body_arch"] iframe div.o_mail_block_title_text', + content: _t('Click on this paragraph to edit it.'), + position: 'top', + edition: 'community', + run: 'click', + }, { + trigger: 'button[name="action_test"]', + content: _t("Test this mailing by sending a copy to yourself."), + position: 'bottom', + }, { + trigger: 'button[name="send_mail_test"]', + content: _t("Check the email address and click send."), + position: 'bottom', + }, { + trigger: 'button[name="action_put_in_queue"]', + content: _t("Ready for take-off!"), + position: 'bottom', + }, { + trigger: '.btn-primary:contains("Ok")', + content: _t("Don't worry, the mailing contact we created is an internal user."), + position: 'bottom', + run: "click", + }, { + trigger: '.o_back_button', + content: _t("By using the Breadcrumb, you can navigate back to the overview."), + position: 'bottom', + run: 'click', + }] + ); +}); diff --git a/addons/mass_mailing/static/src/xml/mass_mailing.xml b/addons/mass_mailing/static/src/xml/mass_mailing.xml index 266d7931ec5..b4a3bfce26b 100644 --- a/addons/mass_mailing/static/src/xml/mass_mailing.xml +++ b/addons/mass_mailing/static/src/xml/mass_mailing.xml @@ -6,7 +6,7 @@