diff --git a/addons/website/controllers/backend.py b/addons/website/controllers/backend.py
index 89355a74554..87f9a42eb9a 100644
--- a/addons/website/controllers/backend.py
+++ b/addons/website/controllers/backend.py
@@ -28,8 +28,7 @@ class WebsiteBackend(http.Controller):
multi_website = request.env.user.has_group('website.group_multi_website')
websites = multi_website and request.env['website'].search([]) or current_website
dashboard_data['websites'] = websites.read(['id', 'name'])
- for rec, website in zip(websites, dashboard_data['websites']):
- website['domain'] = rec._get_http_domain()
+ for website in dashboard_data['websites']:
if website['id'] == current_website.id:
website['selected'] = True
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py
index d4aac43473d..ef193673f3c 100644
--- a/addons/website/controllers/main.py
+++ b/addons/website/controllers/main.py
@@ -108,10 +108,10 @@ class Website(Home):
if not isredir and website.domain:
domain_from = request.httprequest.environ.get('HTTP_HOST', '')
- domain_to = werkzeug.urls.url_parse(website._get_http_domain()).netloc
+ domain_to = werkzeug.urls.url_parse(website.domain).netloc
if domain_from != domain_to:
# redirect to correct domain for a correct routing map
- url_to = werkzeug.urls.url_join(website._get_http_domain(), '/website/force/%s?isredir=1&path=%s' % (website.id, path))
+ url_to = werkzeug.urls.url_join(website.domain, '/website/force/%s?isredir=1&path=%s' % (website.id, path))
return request.redirect(url_to)
website._force()
return request.redirect(path)
diff --git a/addons/website/models/ir_model.py b/addons/website/models/ir_model.py
index 35eb225d8ff..67f7dd28685 100644
--- a/addons/website/models/ir_model.py
+++ b/addons/website/models/ir_model.py
@@ -27,11 +27,11 @@ class BaseModel(models.AbstractModel):
if self._name == 'website':
# Note that website_1.company_id.website_id might not be website_1
- return self._get_http_domain() or super().get_base_url()
+ return self.domain or super().get_base_url()
if 'website_id' in self and self.website_id.domain:
- return self.website_id._get_http_domain()
+ return self.website_id.domain
if 'company_id' in self and self.company_id.website_id.domain:
- return self.company_id.website_id._get_http_domain()
+ return self.company_id.website_id.domain
return super().get_base_url()
def get_website_meta(self):
diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py
index 698bc82093c..bd107afd514 100644
--- a/addons/website/models/ir_ui_view.py
+++ b/addons/website/models/ir_ui_view.py
@@ -447,9 +447,9 @@ class View(models.Model):
cur = Website.get_current_website()
if self.env.user.has_group('website.group_website_publisher') and self.env.user.has_group('website.group_multi_website'):
- qcontext['multi_website_websites_current'] = {'website_id': cur.id, 'name': cur.name, 'domain': cur._get_http_domain()}
+ qcontext['multi_website_websites_current'] = cur.name
qcontext['multi_website_websites'] = [
- {'website_id': website.id, 'name': website.name, 'domain': website._get_http_domain()}
+ {'website_id': website.id, 'name': website.name, 'domain': website.domain}
for website in Website.search([]) if website != cur
]
diff --git a/addons/website/models/res_config_settings.py b/addons/website/models/res_config_settings.py
index 9d621f483c5..e1048a4b1de 100644
--- a/addons/website/models/res_config_settings.py
+++ b/addons/website/models/res_config_settings.py
@@ -179,12 +179,12 @@ class ResConfigSettings(models.TransientModel):
}
def action_ping_sitemap(self):
- if not self.website_id._get_http_domain():
+ if not self.website_id.domain:
raise UserError(_("You haven't defined your domain"))
return {
'type': 'ir.actions.act_url',
- 'url': 'http://www.google.com/ping?sitemap=%s/sitemap.xml' % self.website_id._get_http_domain(),
+ 'url': 'http://www.google.com/ping?sitemap=%s/sitemap.xml' % self.website_id.domain,
'target': 'new',
}
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index e9984da40c8..7cda5b1afef 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
@@ -976,7 +976,7 @@ class Website(models.Model):
is host:port in the version of `url_parse` we use."""
# Here we add http:// to the domain if it's not set because
# `url_parse` expects it to be set to correctly return the `netloc`.
- website_domain = urls.url_parse(website._get_http_domain()).netloc
+ website_domain = urls.url_parse(website.domain or '').netloc
if ignore_port:
website_domain = _remove_port(website_domain)
domain_name = _remove_port(domain_name)
@@ -1286,18 +1286,6 @@ class Website(models.Model):
'target': 'self',
}
- def _get_http_domain(self):
- """Get the domain of the current website, prefixed by http if no
- scheme is specified.
-
- Empty string if no domain is specified on the website.
- """
- self.ensure_one()
- if not self.domain:
- return ''
- res = urls.url_parse(self.domain)
- return 'http://' + self.domain if not res.scheme else self.domain
-
def _get_canonical_url_localized(self, lang, canonical_params):
"""Returns the canonical URL for the current request with translatable
elements appropriately translated in `lang`.
diff --git a/addons/website/views/website_navbar_templates.xml b/addons/website/views/website_navbar_templates.xml
index 4432ac7ab43..328fb7675e1 100644
--- a/addons/website/views/website_navbar_templates.xml
+++ b/addons/website/views/website_navbar_templates.xml
@@ -88,12 +88,12 @@
-