diff --git a/addons/test_website/models/__init__.py b/addons/test_website/models/__init__.py index 73eedbdbab2..330ccbbad9f 100644 --- a/addons/test_website/models/__init__.py +++ b/addons/test_website/models/__init__.py @@ -1,2 +1,3 @@ from . import model +from . import res_config_settings from . import website diff --git a/addons/test_website/models/res_config_settings.py b/addons/test_website/models/res_config_settings.py new file mode 100644 index 00000000000..595bdf0f1ce --- /dev/null +++ b/addons/test_website/models/res_config_settings.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + def action_website_test_setting(self): + return self.env['website'].get_client_action('/') diff --git a/addons/test_website/static/tests/tours/website_settings.js b/addons/test_website/static/tests/tours/website_settings.js new file mode 100644 index 00000000000..8886c22965a --- /dev/null +++ b/addons/test_website/static/tests/tours/website_settings.js @@ -0,0 +1,57 @@ +/** @odoo-module */ + +import { registry } from "@web/core/registry"; +import { stepUtils } from "@web_tour/tour_service/tour_utils"; + +const websiteName = "Website Test Settings"; + +registry.category("web_tour.tours").add("website_settings_m2o_dirty", { + test: true, + url: "/web", + steps: [ + stepUtils.showAppsMenuItem(), + { + content: "open settings", + trigger: ".o_app[data-menu-xmlid='base.menu_administration']", + }, + { + content: "open website settings", + trigger: ".settings_tab .tab[data-key='website']", + }, + { + content: "check that the 'Shared Customers Accounts' setting is checked", + trigger: "input[id^='shared_user_account']:checked", + isCheck: true, + }, + { + content: "open website switcher", + trigger: "input[id^='website_id']", + }, + { + content: `select ${websiteName} in the website switcher`, + trigger: `li:has(.dropdown-item:contains('${websiteName}'))`, + }, + { + content: `check that the settings of ${websiteName} are loaded (Shared Customers Accounts)`, + trigger: "input[id^='shared_user_account']:not(:checked)", + isCheck: true, + }, + { + content: "click on the fake website setting after checking the edited website", + trigger: "button[name='action_website_test_setting']", + }, + { + content: "check that we are on '/'", + trigger: "iframe body div#wrap", + run: function () { + if (window.location.pathname !== "/") { + // If this fails, it's probably because the change of website + // in the settings dirty the record and so there is a dialog + // save/discard displayed. This test ensure that does not happen + // because it makes actions unreachable in multi website. + console.error("We should be on '/' the settings didn't work"); + } + }, + }, + ], +}); diff --git a/addons/test_website/tests/__init__.py b/addons/test_website/tests/__init__.py index bf348803856..9f5896c05be 100644 --- a/addons/test_website/tests/__init__.py +++ b/addons/test_website/tests/__init__.py @@ -15,4 +15,5 @@ from . import test_qweb from . import test_redirect from . import test_reset_views from . import test_session +from . import test_settings from . import test_views_during_module_operation diff --git a/addons/test_website/tests/test_settings.py b/addons/test_website/tests/test_settings.py new file mode 100644 index 00000000000..adad0a81c9b --- /dev/null +++ b/addons/test_website/tests/test_settings.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import odoo +import odoo.tests + +@odoo.tests.tagged('-at_install', 'post_install') +class TestWebsiteSettings(odoo.tests.HttpCase): + def test_01_multi_website_settings(self): + self.env['website'].create({'name': "Website Test Settings", 'specific_user_account': True}) + self.start_tour("/web", 'website_settings_m2o_dirty', login="admin") diff --git a/addons/test_website/views/templates.xml b/addons/test_website/views/templates.xml index 730c1dae14f..ba32f00ff09 100644 --- a/addons/test_website/views/templates.xml +++ b/addons/test_website/views/templates.xml @@ -18,4 +18,17 @@ + + + res.config.settings.view.form.inherit.test.website + res.config.settings + + + +
+
+
+
+