[IMP] website_links, link_tracker: Add action buttons on tree view

This commit adds two buttons on the link.tracker tree view:
  - Visit Page : Redirects the user to the visited page
  - Statistics : Redirects to the page statistics
                 (with the '+' at the end of the shortened url)
In this commit we also add some padding to the graph of the page statistics

LINKS

closes odoo/odoo#37378

Taskid: 2075858
Pr: #37344
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
qmo-odoo
2019-09-25 14:06:24 +00:00
committed by Aurélien Warnon
parent c250df13f4
commit 403bf9e76f
7 changed files with 35 additions and 1 deletions
@@ -62,6 +62,7 @@
<field name="url"/>
<field name="short_url"/>
<field name="count"/>
<button name="action_visit_page" class="btn btn-secondary border ml-5" type="object" string="Visit Page"/>
</tree>
</field>
</record>
+1
View File
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from . import controller
from . import models
+1
View File
@@ -9,6 +9,7 @@ Those trackers can be used in Google Analytics to track clicks and visitors, or
'version': '1.0',
'depends': ['website', 'link_tracker'],
'data': [
'views/link_tracker_views.xml',
'views/website_links_template.xml',
'views/website_links_graphs.xml',
'security/ir.model.access.csv',
+3
View File
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import link_tracker
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
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',
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="link_tracker_view_tree" model="ir.ui.view">
<field name="name">link.tracker.view.tree.inherit.website.links</field>
<field name="model">link.tracker</field>
<field name="inherit_id" ref="link_tracker.link_tracker_view_tree"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_visit_page']" position="after">
<button name="action_visit_page_statistics" class="btn btn-secondary border" type="object" string="Statistics"/>
</xpath>
</field>
</record>
</odoo>
@@ -104,7 +104,7 @@
</h1>
<div class="row">
<div class="col-md-12 mb8">
<div class="col-md-12 mb128">
<div class="tab-content">
<!-- All Time Charts -->