+2








bc0a0cead6
The new list and form views were merged recently [1], but they weren't activated because they weren't 100% ready yet. This is now the case. This commit adds those views to the view registry. As a consequence, a lot of qunit tests and tours needed to be adapted, mostly for selector changes. We also add legacy list and form views to the view registry, with keys 'legacy_list' and 'legacy_form'. This allows to force those legacy views when necessary. For instance, we did it in views using complex custom legacy x2many field widgets that haven't been converted yet (we have a compatibility layer but it isn't complete and doesn't support every advanced usecases). [1] odoo/odoo#92475 Part-of: odoo/odoo#78221 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Bruno Boi <boi@odoo.com> Co-authored-by: Géry Debongnie <ged@odoo.com> Co-authored-by: Samuel Degueldre <sad@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Simon Genin (ges) <ges@odoo.com> Co-authored-by: Francois (fge) <fge@odoo.com> Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com> Co-authored-by: luvi <luvi@odoo.com>
76 lines
2.5 KiB
JavaScript
76 lines
2.5 KiB
JavaScript
odoo.define('auth_totp_mail.tours', function(require) {
|
|
"use strict";
|
|
|
|
const tour = require('web_tour.tour');
|
|
|
|
function openAccountSettingsTab() {
|
|
return [{
|
|
content: 'Go to settings',
|
|
trigger: '[data-menu-xmlid="base.menu_administration"]'
|
|
}, {
|
|
content: 'Wait for page',
|
|
trigger: '.o_menu_brand:contains("Settings")',
|
|
run: () => {}
|
|
}, {
|
|
content: "Open Users menu",
|
|
trigger: '[data-menu-xmlid="base.menu_users"]'
|
|
}, {
|
|
content: "Open Users view",
|
|
trigger: '[data-menu-xmlid="base.menu_action_res_users"]',
|
|
run: function (helpers) {
|
|
// funny story: the users view we're trying to reach, sometimes we're
|
|
// already there, but if we re-click the next step executes before the
|
|
// action has the time to re-load, the one after that doesn't, and our
|
|
// selection get discarded by the action reloading, so here try to
|
|
// see if we're already on the users action through the breadcrumb and
|
|
// just close the menu if so
|
|
const $crumb = $('.breadcrumb');
|
|
if ($crumb.text().indexOf('Users') === -1) {
|
|
// on general settings page, click menu
|
|
helpers.click();
|
|
} else {
|
|
// else close menu
|
|
helpers.click($('[data-menu-xmlid="base.menu_users"]'));
|
|
}
|
|
}
|
|
}];
|
|
}
|
|
|
|
tour.register('totp_admin_self_invite', {
|
|
test: true,
|
|
url: '/web'
|
|
}, [tour.stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), {
|
|
content: "open the user's form",
|
|
trigger: "td.o_data_cell:contains(admin)",
|
|
}, {
|
|
content: "go to Account security Tab",
|
|
trigger: "a.nav-link:contains(Account Security)",
|
|
}, {
|
|
content: "check that user cannot invite themselves to use 2FA.",
|
|
trigger: "body",
|
|
run: function () {
|
|
const inviteBtn = $('button:contains(Invite to use 2FA)')[0];
|
|
if (!inviteBtn) {
|
|
$('body').addClass('CannotInviteYourself');
|
|
}
|
|
}
|
|
}, {
|
|
content: "check that user cannot invite themself.",
|
|
trigger: "body.CannotInviteYourself"
|
|
}]);
|
|
|
|
tour.register('totp_admin_invite', {
|
|
test: true,
|
|
url: '/web'
|
|
}, [tour.stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), {
|
|
content: "open the user's form",
|
|
trigger: "td.o_data_cell:contains(demo)",
|
|
}, {
|
|
content: "go to Account security Tab",
|
|
trigger: "a.nav-link:contains(Account Security)",
|
|
}, {
|
|
content: "check that demo user can be invited to use 2FA.",
|
|
trigger: "button:contains(Invite to use 2FA)",
|
|
}]);
|
|
|
|
}); |