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"""