Browse Source

[11.0][MIG] website_google_tag_manager: Migration to 11.0

pull/524/head
Cris Martín 8 months ago
parent
commit
4552b8f3b4

+ 3
- 0
.gitignore View File

@@ -56,3 +56,6 @@ docs/_build/
56 56
 
57 57
 # Debug maps
58 58
 *.css.map
59
+
60
+# iOS
61
+.DS_Store

+ 52
- 38
website_google_tag_manager/README.rst View File

@@ -1,65 +1,79 @@
1
-.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2
-   :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3
-   :alt: License: AGPL-3
4
-
5
-==================
6
-Google Tag Manager
7
-==================
1
+==========================
2
+Website Google Tag Manager
3
+==========================
4
+
5
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6
+   !! This file is generated by oca-gen-addon-readme !!
7
+   !! changes will be overwritten.                   !!
8
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9
+
10
+.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11
+    :target: https://odoo-community.org/page/development-status
12
+    :alt: Beta
13
+.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14
+    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15
+    :alt: License: AGPL-3
16
+.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
17
+    :target: https://github.com/OCA/website/tree/11.0/website_google_tag_manager
18
+    :alt: OCA/website
19
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20
+    :target: https://translation.odoo-community.org/projects/website-11-0/website-11-0-website_google_tag_manager
21
+    :alt: Translate me on Weblate
22
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23
+    :target: https://runbot.odoo-community.org/runbot/111/11.0
24
+    :alt: Try me on Runbot
25
+
26
+|badge1| |badge2| |badge3| |badge4| |badge5|
8 27
 
9 28
 This module allows to configure your Odoo website to support
10
-the Google `Tag Manager <https://www.google.com/analytics/tag-manager/>`_ tool.
11
-
12
-Configuration
13
-=============
29
+the `Google Tag Manager <https://marketingplatform.google.com/about/tag-manager/>`_ tool.
14 30
 
15
-To configure this module, you need to:
31
+**Table of contents**
16 32
 
17
-* go to `Website Admin/Configuration`
18
-* fill in your `Google Tag Manager Key` (e.g. `GTM-ABCDEF`)
33
+.. contents::
34
+   :local:
19 35
 
20
-.. figure:: website_google_tag_manager/static/description/image.png
21
-   :alt: alternative description
22
-   :width: 600 px
23
-
24
-Usage
25
-=====
36
+CONFIGURATION
37
+=============
26 38
 
27
-.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
28
-   :alt: Try me on Runbot
29
-   :target: https://runbot.odoo-community.org/runbot/186/9.0
39
+#. Go to **Website > Configuration > Settings**
40
+#. Check 'Google Tag Manager' option.
41
+#. Fill in your 'Google Tag Manager Key' (e.g. 'GTM-ABCDEF').
30 42
 
31 43
 Bug Tracker
32 44
 ===========
33 45
 
34
-Bugs are tracked on `GitHub Issues
35
-<https://github.com/OCA/website/issues>`_. In case of trouble, please
36
-check there if your issue has already been reported. If you spotted it first,
37
-help us smashing it by providing a detailed and welcomed feedback.
46
+Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/issues>`_.
47
+In case of trouble, please check there if your issue has already been reported.
48
+If you spotted it first, help us smashing it by providing a detailed and welcomed
49
+`feedback <https://github.com/OCA/website/issues/new?body=module:%20website_google_tag_manager%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
50
+
51
+Do not contact contributors directly about support or help with technical issues.
38 52
 
39 53
 Credits
40 54
 =======
41 55
 
42
-Images
43
-------
56
+Contributors
57
+~~~~~~~~~~~~
58
+* `Sebastien Alix <sebastien.alix@osiell.com>`_
44 59
 
45
-* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
60
+* `Tecnativa <https://www.tecnativa.com>`_:
46 61
 
47
-Contributors
48
-------------
62
+  * Cristina Martin
49 63
 
50
-* Sebastien Alix <sebastien.alix@osiell.com>
64
+Maintainers
65
+~~~~~~~~~~~
51 66
 
52
-Maintainer
53
-----------
67
+This module is maintained by the OCA.
54 68
 
55 69
 .. image:: https://odoo-community.org/logo.png
56 70
    :alt: Odoo Community Association
57 71
    :target: https://odoo-community.org
58 72
 
59
-This module is maintained by the OCA.
60
-
61 73
 OCA, or the Odoo Community Association, is a nonprofit organization whose
62 74
 mission is to support the collaborative development of Odoo features and
63 75
 promote its widespread use.
64 76
 
65
-To contribute to this module, please visit https://odoo-community.org.
77
+This module is part of the `OCA/website <https://github.com/OCA/website/tree/11.0/website_google_tag_manager>`_ project on GitHub.
78
+
79
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+ 1
- 1
website_google_tag_manager/__init__.py View File

@@ -1,3 +1,3 @@
1
-# -*- coding: utf-8 -*-
1
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
2 2
 
3 3
 from . import models

+ 25
- 0
website_google_tag_manager/__manifest__.py View File

@@ -0,0 +1,25 @@
1
+# Copyright 2016 ABF OSIELL <http://osiell.com>
2
+# Copyright 2018 Tecnativa - Cristina Martin R.
3
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
+{
5
+    "name": "Google Tag Manager",
6
+    "version": "11.0.1.0.0",
7
+    "author": "ABF OSIELL, Tecnativa, Odoo Community Association (OCA)",
8
+    "license": "AGPL-3",
9
+    "application": False,
10
+    "installable": True,
11
+    "category": "Website",
12
+    "website": "https://github.com/OCA/website",
13
+    "summary": "Add support for Google Tag Manager",
14
+    "depends": [
15
+        'website',
16
+    ],
17
+    "data": [
18
+        "views/res_config_settings_view.xml",
19
+        "views/website_views.xml",
20
+        'views/website_templates.xml',
21
+    ],
22
+    'images': [
23
+        'static/description/icon.png',
24
+    ],
25
+}

+ 0
- 22
website_google_tag_manager/__openerp__.py View File

@@ -1,22 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Copyright 2016 ABF OSIELL <http://osiell.com>
3
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
-{
5
-    "name": "Google Tag Manager",
6
-    "version": "9.0.1.0.0",
7
-    "author": "ABF OSIELL, Odoo Community Association (OCA)",
8
-    "license": "AGPL-3",
9
-    "category": "Website",
10
-    "summary": "Add support for Google Tag Manager",
11
-    "depends": [
12
-        'website',
13
-    ],
14
-    "data": [
15
-        "views/website_config_settings.xml",
16
-        "views/website.xml",
17
-        'views/templates.xml',
18
-    ],
19
-    "auto_install": False,
20
-    'installable': True,
21
-    "application": False,
22
-}

+ 2
- 2
website_google_tag_manager/models/__init__.py View File

@@ -1,4 +1,4 @@
1
-# -*- coding: utf-8 -*-
1
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2 2
 
3 3
 from . import website
4
-from . import website_config_settings
4
+from . import res_config_settings

+ 13
- 0
website_google_tag_manager/models/res_config_settings.py View File

@@ -0,0 +1,13 @@
1
+# Copyright 2016 ABF OSIELL <http://osiell.com>
2
+# Copyright 2018 Tecnativa - Cristina Martin R.
3
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
+
5
+from odoo import fields, models
6
+
7
+
8
+class ResConfigSettings(models.TransientModel):
9
+    _inherit = 'res.config.settings'
10
+
11
+    google_tag_manager_key = fields.Char(
12
+        'Container ID',
13
+        related='website_id.google_tag_manager_key')

+ 3
- 3
website_google_tag_manager/models/website.py View File

@@ -1,11 +1,11 @@
1
-# -*- coding: utf-8 -*-
2 1
 # Copyright 2016 ABF OSIELL <http://osiell.com>
2
+# Copyright 2018 Tecnativa - Cristina Martin R.
3 3
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4 4
 
5
-from openerp import models, fields
5
+from odoo import fields, models
6 6
 
7 7
 
8 8
 class Website(models.Model):
9 9
     _inherit = 'website'
10 10
 
11
-    google_tag_manager_key = fields.Char(u"Google Tag Manager Key")
11
+    google_tag_manager_key = fields.Char("Container ID")

+ 0
- 12
website_google_tag_manager/models/website_config_settings.py View File

@@ -1,12 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Copyright 2016 ABF OSIELL <http://osiell.com>
3
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4
-
5
-from openerp import models, fields
6
-
7
-
8
-class WebsiteConfigSettings(models.TransientModel):
9
-    _inherit = 'website.config.settings'
10
-
11
-    google_tag_manager_key = fields.Char(
12
-        related=['website_id', 'google_tag_manager_key'])

+ 5
- 0
website_google_tag_manager/readme/CONFIGURE.rst View File

@@ -0,0 +1,5 @@
1
+To configure this module, you need to:
2
+
3
+#. Go to **Website > Configuration > Settings**
4
+#. Check 'Google Tag Manager' option.
5
+#. Fill in your 'Google Tag Manager Key' (e.g. 'GTM-ABCDEF').

+ 5
- 0
website_google_tag_manager/readme/CONTRIBUTORS.rst View File

@@ -0,0 +1,5 @@
1
+* `Sebastien Alix <sebastien.alix@osiell.com>`_
2
+
3
+* `Tecnativa <https://www.tecnativa.com>`__:
4
+
5
+  * Cristina Martin R.

+ 3
- 0
website_google_tag_manager/readme/DESCRIPTION.rst View File

@@ -0,0 +1,3 @@
1
+This module allows to configure your Odoo website to support the
2
+`Google Tag Manager <https://marketingplatform.google.com/about/tag-manager/>`_
3
+tool.

BIN
website_google_tag_manager/static/description/icon.png View File


+ 0
- 79
website_google_tag_manager/static/description/icon.svg
File diff suppressed because it is too large
View File


BIN
website_google_tag_manager/static/description/image.png View File


+ 39
- 0
website_google_tag_manager/views/res_config_settings_view.xml View File

@@ -0,0 +1,39 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
3
+     Copyright 2018 Tecnativa - Cristina Martin R.
4
+     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
5
+<odoo>
6
+
7
+    <record id="view_website_config_settings" model="ir.ui.view">
8
+        <field name="name">Google Tag Manager</field>
9
+        <field name="model">res.config.settings</field>
10
+        <field name="inherit_id" ref="website.res_config_settings_view_form"/>
11
+        <field name="arch" type="xml">
12
+            <xpath expr="//div[@id='google_maps_setting']" position="after">
13
+                <div class="col-xs-12 col-md-6 o_setting_box" id="google_tag_manager_setting">
14
+                    <div class="o_setting_right_pane">
15
+                        <label for="google_tag_manager_key" string="Google Tag Manager"/>
16
+                        <div class="text-muted">
17
+                           Manage all your tags without editing code.
18
+                        </div>
19
+                        <div class="content-group">
20
+                            <div class="row mt16">
21
+                                <label class="col-md-4 o_light_label" for="google_tag_manager_key"/>
22
+                                <field name="google_tag_manager_key" placeholder="GTM-XXXXX"
23
+                                       attrs="{'required': [('google_management_client_id', '!=', False)]}"/>
24
+                            </div>
25
+                        </div>
26
+
27
+                        <div>
28
+                            <a href="https://support.google.com/tagmanager/answer/6103696#install?hl=en"
29
+                               class="oe_link fa fa-arrow-right" target="_blank">
30
+                                How to get my GTM container ID
31
+                            </a>
32
+                        </div>
33
+                    </div>
34
+                </div>
35
+            </xpath>
36
+        </field>
37
+    </record>
38
+
39
+</odoo>

+ 0
- 23
website_google_tag_manager/views/templates.xml View File

@@ -1,23 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
3
-     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4
-<odoo>
5
-
6
-<template id="layout" inherit_id="website.layout">
7
-    <xpath expr="html/body/*[1]" position="before">
8
-        <t t-if="website and website.google_tag_manager_key">
9
-            <!-- Google Tag Manager (noscript) -->
10
-            <noscript><iframe t-attf-src="https://www.googletagmanager.com/ns.html?id=#{website.google_tag_manager_key}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
11
-            <!-- End Google Tag Manager (noscript) -->
12
-        </t>
13
-    </xpath>
14
-    <xpath expr="html/head" position="inside">
15
-        <t t-if="website and website.google_tag_manager_key">
16
-            <!-- Google Tag Manager -->
17
-            <script type="text/javascript">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','<t t-esc="website.google_tag_manager_key" />');</script>
18
-            <!-- End Google Tag Manager -->
19
-        </t>
20
-    </xpath>
21
-</template>
22
-
23
-</odoo>

+ 0
- 16
website_google_tag_manager/views/website.xml View File

@@ -1,16 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
3
-     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4
-<odoo>
5
-
6
-<record id="view_website_form" model="ir.ui.view">
7
-    <field name="model">website</field>
8
-    <field name="inherit_id" ref="website.view_website_form" />
9
-    <field name="arch" type="xml">
10
-        <field name="google_analytics_key" position="after">
11
-            <field name="google_tag_manager_key" placeholder="GTM-XXXXX"/>
12
-        </field>
13
-    </field>
14
-</record>
15
-
16
-</odoo>

+ 0
- 16
website_google_tag_manager/views/website_config_settings.xml View File

@@ -1,16 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
3
-     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4
-<odoo>
5
-
6
-<record id="view_website_config_settings" model="ir.ui.view">
7
-    <field name="model">website.config.settings</field>
8
-    <field name="inherit_id" ref="website.view_website_config_settings" />
9
-    <field name="arch" type="xml">
10
-        <div name="google_analytics_key" position="after">
11
-            <field name="google_tag_manager_key" placeholder="GTM-XXXXX"/>
12
-        </div>
13
-    </field>
14
-</record>
15
-
16
-</odoo>

+ 30
- 0
website_google_tag_manager/views/website_templates.xml View File

@@ -0,0 +1,30 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
3
+     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4
+<odoo>
5
+
6
+    <template id="layout" inherit_id="website.layout">
7
+        <xpath expr="//div[@id='wrapwrap']" position="before">
8
+            <t t-if="website and website.google_tag_manager_key">
9
+                <!-- Google Tag Manager (noscript) -->
10
+                <noscript><iframe t-attf-src="https://www.googletagmanager.com/ns.html?id=#{website.google_tag_manager_key}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
11
+                <!-- End Google Tag Manager (noscript) -->
12
+            </t>
13
+        </xpath>
14
+    </template>
15
+
16
+        <template id="web_layout" inherit_id="website.layout">
17
+        <xpath expr="//meta[@name='generator']" position="before">
18
+            <t t-if="website and website.google_tag_manager_key">
19
+                <!-- Google Tag Manager -->
20
+                <script type="text/javascript">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
21
+new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
22
+j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=
23
+'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
24
+})(window,document,'script','dataLayer','<t t-esc="website.google_tag_manager_key" />');</script>
25
+                <!-- End Google Tag Manager -->
26
+            </t>
27
+        </xpath>
28
+    </template>
29
+
30
+</odoo>

+ 16
- 0
website_google_tag_manager/views/website_views.xml View File

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!-- Copyright 2016 ABF OSIELL <http://osiell.com>
3
+     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4
+<odoo>
5
+
6
+    <record id="view_website_form" model="ir.ui.view">
7
+        <field name="model">website</field>
8
+        <field name="inherit_id" ref="website.view_website_form" />
9
+        <field name="arch" type="xml">
10
+            <field name="google_analytics_key" position="after">
11
+                <field name="google_tag_manager_key" placeholder="GTM-XXXXX"/>
12
+            </field>
13
+        </field>
14
+    </record>
15
+
16
+</odoo>

Loading…
Cancel
Save