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 Mar 4, 2024
1 parent 4e479d1 commit a8acd92
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 36 deletions.
5 changes: 5 additions & 0 deletions website_cookiefirst/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,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
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]>
5 changes: 5 additions & 0 deletions website_cookiefirst/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ <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">
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 a8acd92

Please sign in to comment.