Skip to content

Commit

Permalink
[MIG] website_cookiebot: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NICO-SOLUTIONS committed Jun 30, 2023
1 parent 9133d8c commit e515650
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion website_cookiebot/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Website Cookiebot",
"summary": "Ask for cookies consent connecting with Cookiebot",
"category": "Website",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"author": "Trey (www.trey.es), Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/website",
"license": "AGPL-3",
Expand Down
3 changes: 3 additions & 0 deletions website_cookiebot/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
* `Tecnativa <https://www.tecnativa.com/>`__:
* Jairo Llopis
* Stefan Ungureanu

* `NICO SOLUTIONS - ENGINEERING & IT <https://www.nico-solutions.de/>`__:
* Nils Coenen <[email protected]>
3 changes: 3 additions & 0 deletions website_cookiebot/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_res_config_settings
24 changes: 24 additions & 0 deletions website_cookiebot/tests/test_res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2021 NICO SOLUTIONS - ENGINEERING & 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(TestResConfigSettings, self).setUp()
self.website = self.env["website"].create(
{"name": "Test Website", "cookiebot_dgid": "test_dgid"}
)
self.res_config_settings = self.env["res.config.settings"].create(
{"website_id": self.website.id}
)

def test_compute_cookiebot_enabled(self):
self.res_config_settings._compute_cookiebot_enabled()
self.assertTrue(self.res_config_settings.cookiebot_enabled)

def test_compute_cookiebot_enabled_no_dgid(self):
self.website.cookiebot_dgid = False
self.res_config_settings._compute_cookiebot_enabled()
self.assertFalse(self.res_config_settings.cookiebot_enabled)
2 changes: 1 addition & 1 deletion website_cookiebot/wizards/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class ResConfigSettings(models.TransientModel):
@api.depends("website_id.cookiebot_dgid")
def _compute_cookiebot_enabled(self):
for record in self:
record.cookiebot_enabled = bool(record.cookiebot_dgid)
record.update({"cookiebot_enabled": bool(record.cookiebot_dgid)})
5 changes: 1 addition & 4 deletions website_cookiebot/wizards/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
<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='google_analytics_dashboard_setting']"
position="after"
>
<xpath expr="//div[@id='google_analytics_setting']" position="after">
<div class="col-xs-12 col-md-6 o_setting_box" id="cookiebot_setting">
<div class="o_setting_left_pane">
<field name="cookiebot_enabled" />
Expand Down

0 comments on commit e515650

Please sign in to comment.