Browse Source

💚 mail_to: Fixing tours

Signed-off-by: Vildan Safin <safin@it-projects.info>
pull/299/head
Vildan Safin 4 years ago
parent
commit
3d1ba145a5
  1. 2
      mail_to/static/src/js/mail_to.js
  2. 28
      mail_to/static/src/js/test_mail_to.js
  3. 1
      mail_to/templates.xml
  4. 9
      mail_to/tests/test_default.py

2
mail_to/static/src/js/mail_to.js

@ -15,7 +15,7 @@ odoo.define('mail_to.MailTo', function (require) {
msg.partner_ids = data.partner_ids;
msg.channel_names = data.channel_names;
msg.channel_ids = data.channel_ids;
msg.recipients = data.partner_ids.concat(data.channel_names);
msg.recipients = data.partner_ids.concat(data.channel_names ? data.channel_names : []);
if (!msg.partner_ids && !msg.channel_names) {
return msg;
}

28
mail_to/static/src/js/test_mail_to.js

@ -7,13 +7,27 @@ odoo.define('mail_to.tour', function (require) {
var core = require('web.core');
var _t = core._t;
var email = 'mail_private test email';
var steps = [{
trigger: 'a.recipient_link:first',
content: _t("Open Partners Form From Recipient Link"),
position: 'bottom',
timeout: 70000,
}];
var steps = [tour.STEPS.SHOW_APPS_MENU_ITEM, {
trigger: '.o_app[data-menu-xmlid="mail.menu_root_discuss"]',
content: _t('Want to <b>get in touch</b> with your contacts? <i>Discuss with them here.</i>'),
position: 'right',
edition: 'community',
},{
trigger: '.fa.fa-plus.o_add[data-type="public"]',
position: 'right',
edition: 'community',
run: function (actions) {
$('.o_input.ui-autocomplete-input').val("Channel #" + String(new Date().getTime()));
$('.o_input.ui-autocomplete-input').keydown();
setTimeout(function(){
$('.ui-menu-item > a').click();
}, 1000);
},
},{
trigger: 'a.recipient_link:first',
content: _t("Open Partners Form From Recipient Link"),
position: 'bottom',
}];
tour.register('mail_to_tour', { test: true, url: '/web' }, steps);

1
mail_to/templates.xml

@ -13,6 +13,7 @@
<xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_to/static/src/css/mail_to.css"/>
<script src="/mail_to/static/src/js/mail_to.js" type="text/javascript"></script>
<script src="/mail_to/static/src/js/test_mail_to.js" type="text/javascript"></script>
</xpath>
</template>
</data>

9
mail_to/tests/test_default.py

@ -41,16 +41,11 @@ class TestUi(odoo.tests.HttpCase):
env["mail.notification"].create(
{"res_partner_id": p, "mail_message_id": msg.id, "is_read": False}
)
code = """
setTimeout(function () {
console.log($('a.recipient_link').length && 'ok' || 'error');
}, 3000);
"""
link = "/web#%s" % url_encode({"action": "mail.action_discuss"})
self.phantom_js(
link,
code,
"odoo.__DEBUG__.services['web_tour.tour'].tours.mail_tour.ready",
"odoo.__DEBUG__.services['web_tour.tour'].run('mail_to_tour', 1000);",
"odoo.__DEBUG__.services['web_tour.tour'].tours.mail_to_tour.ready",
login="admin",
)
Loading…
Cancel
Save