From f2eb0e33a29fa048366b458408fcdc41b130bfbe Mon Sep 17 00:00:00 2001 From: Kaushal Prajapati Date: Mon, 25 Dec 2017 12:25:53 +0530 Subject: [PATCH] [IMP] "website_links" compatible with Multi-Website --- addons/website_links/__init__.py | 1 + addons/website_links/__manifest__.py | 1 + addons/website_links/models/__init__.py | 3 ++ addons/website_links/models/link_tracker.py | 11 ++++++ .../static/src/js/website_links.js | 1 + addons/website_links/views/link_tracker.xml | 35 +++++++++++++++++++ .../views/website_links_template.xml | 10 ++++++ 7 files changed, 62 insertions(+) create mode 100644 addons/website_links/models/__init__.py create mode 100644 addons/website_links/models/link_tracker.py create mode 100644 addons/website_links/views/link_tracker.xml diff --git a/addons/website_links/__init__.py b/addons/website_links/__init__.py index 65d7531a..59ba9124 100644 --- a/addons/website_links/__init__.py +++ b/addons/website_links/__init__.py @@ -1,2 +1,3 @@ # -*- coding: utf-8 -*- from . import controller +from . import models diff --git a/addons/website_links/__manifest__.py b/addons/website_links/__manifest__.py index d6a0ba83..5b7aae66 100644 --- a/addons/website_links/__manifest__.py +++ b/addons/website_links/__manifest__.py @@ -10,6 +10,7 @@ Website interface to create short and trackable URLs. 'version': '1.0', 'depends': ['website', 'link_tracker'], 'data': [ + 'views/link_tracker.xml', 'views/website_links_template.xml', 'views/website_links_graphs.xml', 'security/ir.model.access.csv', diff --git a/addons/website_links/models/__init__.py b/addons/website_links/models/__init__.py new file mode 100644 index 00000000..895d0b60 --- /dev/null +++ b/addons/website_links/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import link_tracker diff --git a/addons/website_links/models/link_tracker.py b/addons/website_links/models/link_tracker.py new file mode 100644 index 00000000..a7db389e --- /dev/null +++ b/addons/website_links/models/link_tracker.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +from flectra import models, fields, api, _ + + +class LinkTracker(models.Model): + + _inherit = "link.tracker" + + website_id = fields.Many2one('website', string="Link For Website", + required=True) diff --git a/addons/website_links/static/src/js/website_links.js b/addons/website_links/static/src/js/website_links.js index 6a4bf876..8100f968 100644 --- a/addons/website_links/static/src/js/website_links.js +++ b/addons/website_links/static/src/js/website_links.js @@ -351,6 +351,7 @@ if (!$('.o_website_links_create_tracked_url').length) { var params = {}; params.url = $("#url").val(); + params.website_id = $("#website_id").val(); if (campaign_id !== '') { params.campaign_id = parseInt(campaign_id); } if (medium_id !== '') { params.medium_id = parseInt(medium_id); } if (source_id !== '') { params.source_id = parseInt(source_id); } diff --git a/addons/website_links/views/link_tracker.xml b/addons/website_links/views/link_tracker.xml new file mode 100644 index 00000000..c73572bd --- /dev/null +++ b/addons/website_links/views/link_tracker.xml @@ -0,0 +1,35 @@ + + + + + link.tracker.form.inherit + link.tracker + + + + + + + + + + view.link.tracker.filter + link.tracker + + + + + + + + + + + Link Tracker + link.tracker + form + tree,form,graph + + + diff --git a/addons/website_links/views/website_links_template.xml b/addons/website_links/views/website_links_template.xml index 44ad0259..26edc9bb 100644 --- a/addons/website_links/views/website_links_template.xml +++ b/addons/website_links/views/website_links_template.xml @@ -79,6 +79,16 @@ + +
+ + +
+ +
+