diff --git a/website_cookiebot/__manifest__.py b/website_cookiebot/__manifest__.py
index bb7f1ef580..a14c7a2474 100644
--- a/website_cookiebot/__manifest__.py
+++ b/website_cookiebot/__manifest__.py
@@ -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",
diff --git a/website_cookiebot/readme/CONTRIBUTORS.rst b/website_cookiebot/readme/CONTRIBUTORS.rst
index 30435f2fa6..f4a564b9a0 100644
--- a/website_cookiebot/readme/CONTRIBUTORS.rst
+++ b/website_cookiebot/readme/CONTRIBUTORS.rst
@@ -5,3 +5,6 @@
* `Tecnativa `__:
* Jairo Llopis
* Stefan Ungureanu
+
+* `NICO SOLUTIONS - ENGINEERING & IT `__:
+ * Nils Coenen
diff --git a/website_cookiebot/tests/__init__.py b/website_cookiebot/tests/__init__.py
new file mode 100644
index 0000000000..ded7214fa9
--- /dev/null
+++ b/website_cookiebot/tests/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import test_res_config_settings
diff --git a/website_cookiebot/tests/test_res_config_settings.py b/website_cookiebot/tests/test_res_config_settings.py
new file mode 100644
index 0000000000..7ac6a1f3b6
--- /dev/null
+++ b/website_cookiebot/tests/test_res_config_settings.py
@@ -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)
diff --git a/website_cookiebot/wizards/res_config_settings.py b/website_cookiebot/wizards/res_config_settings.py
index a30c374d73..57ce03fc91 100644
--- a/website_cookiebot/wizards/res_config_settings.py
+++ b/website_cookiebot/wizards/res_config_settings.py
@@ -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)})
diff --git a/website_cookiebot/wizards/res_config_settings_views.xml b/website_cookiebot/wizards/res_config_settings_views.xml
index 52c579b7f4..36f09d9c5c 100644
--- a/website_cookiebot/wizards/res_config_settings_views.xml
+++ b/website_cookiebot/wizards/res_config_settings_views.xml
@@ -6,10 +6,7 @@
res.config.settings
-
+