Skip to content

Commit

Permalink
[MIG] website_cookiefirst: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NICO-SOLUTIONS committed Oct 10, 2024
1 parent 34628cf commit 80264d5
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 44 deletions.
12 changes: 11 additions & 1 deletion website_cookiefirst/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Website Cookiefirst
|badge1| |badge2| |badge3| |badge4| |badge5|

This module integrates Odoo website with GDPR through the functionality
of Cookiefirst <https://cookiefirst.com/>, you need to register your
of Cookiefirst (https://cookiefirst.com), you need to register your
website domain in Cookiefirst's portal.

**Table of contents**
Expand All @@ -48,6 +48,11 @@ To configure this module, you need to:
'00000000-0000-0000-0000-000000000000').
4. Click on "Save" button.

⚠️ **Please note: if another cookie consent solution is installed (e.g.
Cookiebot), the execution of the Cookiefirst script will be prevented.
Make sure that no other cookie consent solution is installed when using
the Cookiefirst module.**

Bug Tracker
===========

Expand All @@ -73,6 +78,11 @@ Contributors

- Ioan Galan <[email protected]>

- `NICO SOLUTIONS - ENGINEERING &
IT <https://www.nico-solutions.de>`__:

- Nils Coenen [email protected]

Maintainers
-----------

Expand Down
2 changes: 1 addition & 1 deletion website_cookiefirst/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Website Cookiefirst",
"summary": "Cookiefirst integration",
"category": "Website",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"author": "Studio73, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/website",
"license": "AGPL-3",
Expand Down
5 changes: 5 additions & 0 deletions website_cookiefirst/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ To configure this module, you need to:
3. Fill in your 'Cookiefirst ID' (e.g.
'00000000-0000-0000-0000-000000000000').
4. Click on "Save" button.

⚠️ **Please note: if another cookie consent solution is
installed (e.g. Cookiebot), the execution of the Cookiefirst
script will be prevented. Make sure that no other cookie
consent solution is installed when using the Cookiefirst module.**
4 changes: 3 additions & 1 deletion website_cookiefirst/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
- [Studio73](https://www.studio73.es):
- [Studio73](https://www.studio73.es):
- Ioan Galan \<<[email protected]>\>
- [NICO SOLUTIONS - ENGINEERING & IT](https://www.nico-solutions.de):
- Nils Coenen <[email protected]>
2 changes: 1 addition & 1 deletion website_cookiefirst/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This module integrates Odoo website with GDPR through the functionality
of Cookiefirst \<https://cookiefirst.com/\>, you need to register your
of Cookiefirst (https://cookiefirst.com), you need to register your
website domain in Cookiefirst's portal.
23 changes: 17 additions & 6 deletions website_cookiefirst/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -371,7 +371,7 @@ <h1 class="title">Website Cookiefirst</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/website/tree/17.0/website_cookiefirst"><img alt="OCA/website" src="https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/website-17-0/website-17-0-website_cookiefirst"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/website&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module integrates Odoo website with GDPR through the functionality
of Cookiefirst &lt;<a class="reference external" href="https://cookiefirst.com/">https://cookiefirst.com/</a>&gt;, you need to register your
of Cookiefirst (<a class="reference external" href="https://cookiefirst.com">https://cookiefirst.com</a>), you need to register your
website domain in Cookiefirst’s portal.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -396,6 +396,10 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
‘00000000-0000-0000-0000-000000000000’).</li>
<li>Click on “Save” button.</li>
</ol>
<p>⚠️ <strong>Please note: if another cookie consent solution is installed (e.g.
Cookiebot), the execution of the Cookiefirst script will be prevented.
Make sure that no other cookie consent solution is installed when using
the Cookiefirst module.</strong></p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
Expand All @@ -420,12 +424,19 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Ioan Galan &lt;<a class="reference external" href="mailto:ioan&#64;studio73.es">ioan&#64;studio73.es</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://www.nico-solutions.de">NICO SOLUTIONS - ENGINEERING &amp;
IT</a>:<ul>
<li>Nils Coenen <a class="reference external" href="mailto:nils.coenen&#64;nico-solutions.de">nils.coenen&#64;nico-solutions.de</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
4 changes: 4 additions & 0 deletions website_cookiefirst/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_website
from . import test_res_config_settings
27 changes: 27 additions & 0 deletions website_cookiefirst/tests/test_res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 NICO SOLUTIONS - ENGINEERNG & IT, Nils Coenen
# License APL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import TransactionCase


class TestResConfigSettings(TransactionCase):
def setUp(self):
super().setUp()
self.res_config_settings = self.env["res.config.settings"]

def test_cookiefirst_enabled(self):
website = self.env["website"].create(
{
"name": "Test Website",
"cookiefirst_identifier": "test_identifier",
}
)
res_config_settings = self.res_config_settings.create(
{
"website_id": website.id,
"cookiefirst_identifier": "test_identifier",
}
)
self.assertTrue(res_config_settings.cookiefirst_enabled)
res_config_settings.cookiefirst_enabled = False
self.assertFalse(website.cookiefirst_identifier)
15 changes: 15 additions & 0 deletions website_cookiefirst/tests/test_website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 NICO SOLUTIONS - ENGINEERNG & IT, Nils Coenen
# License APL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import TransactionCase


class TestWebsite(TransactionCase):
def setUp(self):
super().setUp()
self.website = self.env["website"].create(
{"name": "Test Website", "cookiefirst_identifier": "1234567890"}
)

def test_cookiefirst_identifier(self):
self.assertEqual(self.website.cookiefirst_identifier, "1234567890")
59 changes: 25 additions & 34 deletions website_cookiefirst/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='website_cookies_bar_setting']" position="inside">
<div class="o_setting_left_pane">
<field name="cookiefirst_enabled" />
</div>
<div class="o_setting_right_pane">
<label for="cookiefirst_enabled" />
<div class="text-muted">
Add Cookiefirst functionality
</div>
<div
class="content-group"
attrs="{'invisible': [('cookiefirst_enabled', '=', False)]}"
id="cookiefirst_fields"
>
<div class="row mt16">
<label
class="col-md-3 o_light_label"
string="Tracking ID"
for="cookiefirst_identifier"
/>
<field
name="cookiefirst_identifier"
placeholder="00000000-0000-0000-0000-000000000000"
attrs="{'required': [('cookiefirst_enabled', '!=', False)]}"
/>
</div>
</div>
</div>
</xpath>
</field>
</record>
<field name="name">
res.config.settings.view.form.inherit.cookiefirst
</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//setting[@id='website_cookies_bar_setting']" position="after">
<setting id="website_cookiefirst" help="Add Cookiefirst functionality">
<field name="cookiefirst_enabled" />
<div class="mt16" invisible="not cookiefirst_enabled">
<label
class="col-md-3 o_light_label"
string="Tracking ID"
for="cookiefirst_identifier"
/>
<field
name="cookiefirst_identifier"
required="cookiefirst_enabled"
placeholder="00000000-0000-0000-0000-000000000000"
/>
</div>
</setting>
</xpath>
</field>
</record>
</odoo>

0 comments on commit 80264d5

Please sign in to comment.