diff --git a/addons/website/i18n/website.pot b/addons/website/i18n/website.pot
index 420b44e4a4e..e930b3a589c 100644
--- a/addons/website/i18n/website.pot
+++ b/addons/website/i18n/website.pot
@@ -6803,6 +6803,13 @@ msgstr ""
msgid "No support"
msgstr ""
+#. module: website
+#. odoo-javascript
+#: code:addons/website/static/src/systray_items/website_switcher.js:0
+#, python-format
+msgid "No website domain configured for this website."
+msgstr ""
+
#. module: website
#: model_terms:ir.ui.view,arch_db:website.s_chart_options
#: model_terms:ir.ui.view,arch_db:website.s_countdown_options
@@ -9515,6 +9522,22 @@ msgstr ""
msgid "This view arch has been modified"
msgstr ""
+#. module: website
+#. odoo-javascript
+#: code:addons/website/static/src/systray_items/website_switcher.js:0
+#, python-format
+msgid ""
+"This website does not have a domain configured. To avoid unexpected behaviours during website edition, we recommend closing (or refreshing) other browser tabs.\n"
+"To remove this message please set a domain in your website settings"
+msgstr ""
+
+#. module: website
+#. odoo-javascript
+#: code:addons/website/static/src/systray_items/website_switcher.xml:0
+#, python-format
+msgid "This website does not have a domain configured."
+msgstr ""
+
#. module: website
#: model_terms:ir.ui.view,arch_db:website.snippet_options
msgid "Thumbnails"
diff --git a/addons/website/static/src/systray_items/website_switcher.js b/addons/website/static/src/systray_items/website_switcher.js
index 5ab3cb0047c..90f175cb84f 100644
--- a/addons/website/static/src/systray_items/website_switcher.js
+++ b/addons/website/static/src/systray_items/website_switcher.js
@@ -1,5 +1,6 @@
/** @odoo-module **/
+import { browser } from "@web/core/browser/browser";
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { Dropdown } from "@web/core/dropdown/dropdown";
@@ -11,12 +12,15 @@ const { Component } = owl;
export class WebsiteSwitcherSystray extends Component {
setup() {
this.websiteService = useService('website');
+ this.notificationService = useService("notification");
+ this.actionService = useService("action");
}
getElements() {
return this.websiteService.websites.map((website) => ({
name: website.name,
id: website.id,
+ domain: website.domain,
callback: () => {
if (website.domain && !wUtils.isHTTPSorNakedDomainRedirection(website.domain, window.location.origin)) {
const { location: { pathname, search, hash } } = this.websiteService.contentWindow;
@@ -24,6 +28,33 @@ export class WebsiteSwitcherSystray extends Component {
window.location.href = `${encodeURI(website.domain)}/web#action=website.website_preview&path=${encodeURIComponent(path)}&website_id=${encodeURIComponent(website.id)}`;
} else {
this.websiteService.goToWebsite({ websiteId: website.id });
+ if (!website.domain) {
+ const closeFn = this.notificationService.add(
+ this.env._t(
+ "This website does not have a domain configured. To avoid unexpected behaviours during website edition, we recommend closing (or refreshing) other browser tabs.\nTo remove this message please set a domain in your website settings"
+ ),
+ {
+ type: "warning",
+ title: this.env._t(
+ "No website domain configured for this website."
+ ),
+ sticky: true,
+ buttons: [
+ {
+ onClick: () => {
+ this.actionService.doAction(
+ "website.action_website_configuration"
+ );
+ closeFn();
+ },
+ primary: true,
+ name: "Go to Settings",
+ },
+ ],
+ }
+ );
+ browser.setTimeout(closeFn, 7000);
+ }
}
},
class: website.id === this.websiteService.currentWebsite.id ? 'active' : '',
diff --git a/addons/website/static/src/systray_items/website_switcher.xml b/addons/website/static/src/systray_items/website_switcher.xml
index d60233f572e..5d0a3d00b2c 100644
--- a/addons/website/static/src/systray_items/website_switcher.xml
+++ b/addons/website/static/src/systray_items/website_switcher.xml
@@ -11,12 +11,17 @@
+ This website does not have a domain configured.
+ dataset="!element.domain ? {'tooltip': tooltipValue, 'tooltipPosition': 'left'} : undefined">
+
+
+
+
+