[IMP] "website_links" compatible with Multi-Website

This commit is contained in:
Kaushal Prajapati 2017-12-25 12:25:53 +05:30 committed by Siddharth Bhalgami
parent 02881b6e5b
commit f2eb0e33a2
7 changed files with 62 additions and 0 deletions

View File

@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from . import controller
from . import models

View File

@ -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',

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import link_tracker

View File

@ -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)

View File

@ -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); }

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<flectra>
<!-- Website links views -->
<record id="view_link_tracker_form_inherit" model="ir.ui.view">
<field name="name">link.tracker.form.inherit</field>
<field name="model">link.tracker</field>
<field name="inherit_id" ref="link_tracker.view_link_tracker_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='source_id']" position="after">
<field name="website_id"/>
</xpath>
</field>
</record>
<record id="view_link_tracker_filter" model="ir.ui.view">
<field name="name">view.link.tracker.filter</field>
<field name="model">link.tracker</field>
<field name="arch" type="xml">
<search string="Search Link Tracker">
<separator/>
<filter name="website_id" string="Website"
context="{'group_by':'website_id'}"/>
</search>
</field>
</record>
<!-- Action for website links-->
<record model="ir.actions.act_window" id="link_tracker.action_link_tracker">
<field name="name">Link Tracker</field>
<field name="res_model">link.tracker</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="search_view_id" ref="view_link_tracker_filter"/>
</record>
</flectra>

View File

@ -79,6 +79,16 @@
<span id="generated_tracked_link" style="display:none;" class="text-muted"></span>
</div>
</div>
<div class="form-group" id="url-form-group">
<label class="col-sm-3 control-label text-left hidden">
Website
</label>
<div class="col-sm-9">
<input type="hidden" id="website_id" class="form-control" t-att-value="website.id"/>
</div>
</div>
</form>
</div>