Files
odoo_source/addons/website_links/models/link_tracker.py
T
Andrea Grazioso (agr-odoo) fe82ccc860 [FIX] link_tracker,website_links: use specific site url
- Create 3 websites and set a website domain for each
- Install the website_links module
- Go to Website > Configuration > Settings
- Select the website 3
- Go to website
- Menu Promote > Link tracking

The URL field uses the domain you are logged into the database
rather than the domain of the active website

The expected behavior is:
With an ICP set to URL1, a website 1 set to URL2 and a website 2 set to
URL3, going to the link tracker website page from URL3 but with website
1 selected should:

Show the current website domain as placeholder of the input -> URL2
Create link for that current website the user selected -> URL2

opw-2638494

closes odoo/odoo#77705

X-original-commit: d094d76354d6f46db3dc7f8e716b5f778ca26569
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-10-04 14:12:26 +00:00

24 lines
677 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
from werkzeug import urls
class LinkTracker(models.Model):
_inherit = ['link.tracker']
def action_visit_page_statistics(self):
return {
'name': _("Visit Webpage Statistics"),
'type': 'ir.actions.act_url',
'url': '%s+' % (self.short_url),
'target': 'new',
}
def _compute_short_url_host(self):
for tracker in self:
base_url = self.env['website'].get_current_website().get_base_url()
tracker.short_url_host = urls.url_join(base_url, '/r/')