From 4e542fbdacbd997657219ae8b9c552d44e37bf0e Mon Sep 17 00:00:00 2001 From: alt-odoo Date: Tue, 1 Mar 2022 13:22:07 +0000 Subject: [PATCH] [FIX] website: wrong fw-port of commit 971f324c419 Since commit [1], we should use domain instead of _get_http_domain() that was removed. [1]: https://github.com/odoo/odoo/commit/7d8a8ddea0b363732f2177ad589a3e0e10e2fb6c closes odoo/odoo#85692 X-original-commit: 82341e9bd0cad8320fd1b95f3369cf2074978cb0 Signed-off-by: Romain Derie (rde) Signed-off-by: Alex Thuyls (alt) --- addons/website/models/mixins.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/website/models/mixins.py b/addons/website/models/mixins.py index b7e7d0a9da7..9e8497f48a9 100644 --- a/addons/website/models/mixins.py +++ b/addons/website/models/mixins.py @@ -4,6 +4,8 @@ import logging import re +from werkzeug.urls import url_join + from odoo import api, fields, models, _ from odoo.addons.website.tools import text_from_html from odoo.http import request @@ -280,6 +282,13 @@ class WebsitePublishedMultiMixin(WebsitePublishedMixin): else: # should be in the backend, return things that are published anywhere return is_published + def open_website_url(self): + return { + 'type': 'ir.actions.act_url', + 'url': url_join(self.website_id.domain, self.website_url) if self.website_id else self.website_url, + 'target': 'self', + } + class WebsiteSearchableMixin(models.AbstractModel): """Mixin to be inherited by all models that need to searchable through website"""