diff --git a/website_cookiefirst/README.rst b/website_cookiefirst/README.rst new file mode 100644 index 0000000000..9ead971266 --- /dev/null +++ b/website_cookiefirst/README.rst @@ -0,0 +1,101 @@ +=================== +Website Cookiefirst +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9d58d91c5403f8bc612f25d6b2cfcbc2e3a5393f685d5845f8585480d3f17868 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/17.0/website_cookiefirst + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-17-0/website-17-0-website_cookiefirst + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=17.0 + :alt: Try me on Runboat + +|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 +website domain in Cookiefirst's portal. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +1. Go to **Website > Configuration > Settings** +2. Search 'Cookiefirst' option. +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.** + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Studio73 + +Contributors +------------ + +- `Studio73 `__: + + - Ioan Galan + +- `NICO SOLUTIONS - ENGINEERING & + IT `__: + + - Nils Coenen nils.coenen@nico-solutions.de + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_cookiefirst/__init__.py b/website_cookiefirst/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_cookiefirst/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_cookiefirst/__manifest__.py b/website_cookiefirst/__manifest__.py new file mode 100644 index 0000000000..e746bdbfb9 --- /dev/null +++ b/website_cookiefirst/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2021 Studio73 - Ioan Galan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Website Cookiefirst", + "summary": "Cookiefirst integration", + "category": "Website", + "version": "17.0.1.0.0", + "author": "Studio73, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/website", + "license": "AGPL-3", + "depends": ["website"], + "data": [ + "data/cookies_policy.xml", + "views/website_template.xml", + "views/res_config_settings_views.xml", + ], + "installable": True, +} diff --git a/website_cookiefirst/data/cookies_policy.xml b/website_cookiefirst/data/cookies_policy.xml new file mode 100644 index 0000000000..62abbb51e7 --- /dev/null +++ b/website_cookiefirst/data/cookies_policy.xml @@ -0,0 +1,36 @@ + + + + Cookies Policy + qweb + website.cookies + + + +
+
+
+

Cookie Declaration

+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + /legal/cookies-policy + True + + + diff --git a/website_cookiefirst/i18n/de.po b/website_cookiefirst/i18n/de.po new file mode 100644 index 0000000000..bb9a546aac --- /dev/null +++ b/website_cookiefirst/i18n/de.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_cookiefirst +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-07 18:09+0000\n" +"Last-Translator: Nils Coenen \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "00000000-0000-0000-0000-000000000000" +msgstr "" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Add Cookiefirst functionality" +msgstr "Cookiefirst-Funktionalität hinzufügen" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_res_config_settings +msgid "Config Settings" +msgstr "Konfigurationseinstellungen" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.cookies +msgid "Cookie Declaration" +msgstr "Cookie-Erklärung" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,field_description:website_cookiefirst.field_website__cookiefirst_identifier +msgid "Cookiefirst ID" +msgstr "Cookiefirst-ID" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.footer_copyright_company_name +msgid "Cookies Policy" +msgstr "Cookie-Richtlinie" + +#. module: website_cookiefirst +#: model:ir.model.fields,help:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,help:website_cookiefirst.field_website__cookiefirst_identifier +msgid "This field holds the ID, needed for Cookiefirst functionality." +msgstr "" +"Dieses Feld enthält die ID, die für die Cookiefirst-Funktionalität benötigt " +"wird." + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Tracking ID" +msgstr "" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_enabled +msgid "Use Cookiefirst" +msgstr "Verwenden Sie Cookiefirst" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_website +msgid "Website" +msgstr "Webseite" diff --git a/website_cookiefirst/i18n/es.po b/website_cookiefirst/i18n/es.po new file mode 100644 index 0000000000..1fe6b29731 --- /dev/null +++ b/website_cookiefirst/i18n/es.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_cookiefirst +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-09-20 17:50+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "00000000-0000-0000-0000-000000000000" +msgstr "00000000-0000-0000-0000-000000000000" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Add Cookiefirst functionality" +msgstr "Añadir funcionalidad de Cookiefirst" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_res_config_settings +msgid "Config Settings" +msgstr "Configuración de Ajustes" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.cookies +msgid "Cookie Declaration" +msgstr "Declaración de cookies" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,field_description:website_cookiefirst.field_website__cookiefirst_identifier +msgid "Cookiefirst ID" +msgstr "ID Cookiefirst" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.footer_copyright_company_name +msgid "Cookies Policy" +msgstr "Política de Cookies" + +#. module: website_cookiefirst +#: model:ir.model.fields,help:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,help:website_cookiefirst.field_website__cookiefirst_identifier +msgid "This field holds the ID, needed for Cookiefirst functionality." +msgstr "" +"Este campo contiene el ID, necesario para la funcionalidad Cookiefirst." + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Tracking ID" +msgstr "ID de seguimiento" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_enabled +msgid "Use Cookiefirst" +msgstr "Utiliza Cookiefirst" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_website +msgid "Website" +msgstr "Página Web" diff --git a/website_cookiefirst/i18n/it.po b/website_cookiefirst/i18n/it.po new file mode 100644 index 0000000000..30af8f214c --- /dev/null +++ b/website_cookiefirst/i18n/it.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_cookiefirst +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-12-27 17:44+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "00000000-0000-0000-0000-000000000000" +msgstr "00000000-0000-0000-0000-000000000000" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Add Cookiefirst functionality" +msgstr "Aggiungere la funzionalità Cookiefirst" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.cookies +msgid "Cookie Declaration" +msgstr "Dichiarazione cookie" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,field_description:website_cookiefirst.field_website__cookiefirst_identifier +msgid "Cookiefirst ID" +msgstr "ID Cookiefirst" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.footer_copyright_company_name +msgid "Cookies Policy" +msgstr "Politica dei cookie" + +#. module: website_cookiefirst +#: model:ir.model.fields,help:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,help:website_cookiefirst.field_website__cookiefirst_identifier +msgid "This field holds the ID, needed for Cookiefirst functionality." +msgstr "" +"Questo campo memorizza l'ID, richiesto per la funzionalità Cookiefirst." + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Tracking ID" +msgstr "ID tracciatura" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_enabled +msgid "Use Cookiefirst" +msgstr "Utilizza Cookiefirst" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_website +msgid "Website" +msgstr "Sito web" diff --git a/website_cookiefirst/i18n/website_cookiefirst.pot b/website_cookiefirst/i18n/website_cookiefirst.pot new file mode 100644 index 0000000000..a464403a34 --- /dev/null +++ b/website_cookiefirst/i18n/website_cookiefirst.pot @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_cookiefirst +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "00000000-0000-0000-0000-000000000000" +msgstr "" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Add Cookiefirst functionality" +msgstr "" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.cookies +msgid "Cookie Declaration" +msgstr "" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,field_description:website_cookiefirst.field_website__cookiefirst_identifier +msgid "Cookiefirst ID" +msgstr "" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.footer_copyright_company_name +msgid "Cookies Policy" +msgstr "" + +#. module: website_cookiefirst +#: model:ir.model.fields,help:website_cookiefirst.field_res_config_settings__cookiefirst_identifier +#: model:ir.model.fields,help:website_cookiefirst.field_website__cookiefirst_identifier +msgid "This field holds the ID, needed for Cookiefirst functionality." +msgstr "" + +#. module: website_cookiefirst +#: model_terms:ir.ui.view,arch_db:website_cookiefirst.res_config_settings_view_form +msgid "Tracking ID" +msgstr "" + +#. module: website_cookiefirst +#: model:ir.model.fields,field_description:website_cookiefirst.field_res_config_settings__cookiefirst_enabled +msgid "Use Cookiefirst" +msgstr "" + +#. module: website_cookiefirst +#: model:ir.model,name:website_cookiefirst.model_website +msgid "Website" +msgstr "" diff --git a/website_cookiefirst/models/__init__.py b/website_cookiefirst/models/__init__.py new file mode 100644 index 0000000000..ba62e1412d --- /dev/null +++ b/website_cookiefirst/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_config_settings +from . import website diff --git a/website_cookiefirst/models/res_config_settings.py b/website_cookiefirst/models/res_config_settings.py new file mode 100644 index 0000000000..ac0de0df1d --- /dev/null +++ b/website_cookiefirst/models/res_config_settings.py @@ -0,0 +1,29 @@ +# Copyright 2021 Studio73 - Ioan Galan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + @api.depends("website_id.cookiefirst_identifier") + def _compute_cookiefirst_enabled(self): + for record in self: + record.update({"cookiefirst_enabled": bool(record.cookiefirst_identifier)}) + + def _inverse_cookiefirst_enabled(self): + for record in self: + if not record.cookiefirst_enabled: + record.website_id.update({"cookiefirst_identifier": False}) + + cookiefirst_identifier = fields.Char( + string="Cookiefirst ID", + related="website_id.cookiefirst_identifier", + readonly=False, + ) + cookiefirst_enabled = fields.Boolean( + string="Use Cookiefirst", + compute="_compute_cookiefirst_enabled", + inverse="_inverse_cookiefirst_enabled", + ) diff --git a/website_cookiefirst/models/website.py b/website_cookiefirst/models/website.py new file mode 100644 index 0000000000..0762d8f3db --- /dev/null +++ b/website_cookiefirst/models/website.py @@ -0,0 +1,13 @@ +# Copyright 2021 Studio73 - Ioan Galan +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class Website(models.Model): + _inherit = "website" + + cookiefirst_identifier = fields.Char( + string="Cookiefirst ID", + help="This field holds the ID, needed for Cookiefirst functionality.", + ) diff --git a/website_cookiefirst/pyproject.toml b/website_cookiefirst/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_cookiefirst/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_cookiefirst/readme/CONFIGURE.md b/website_cookiefirst/readme/CONFIGURE.md new file mode 100644 index 0000000000..eb90a8e3dd --- /dev/null +++ b/website_cookiefirst/readme/CONFIGURE.md @@ -0,0 +1,12 @@ +To configure this module, you need to: + +1. Go to **Website \> Configuration \> Settings** +2. Search 'Cookiefirst' option. +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.** diff --git a/website_cookiefirst/readme/CONTRIBUTORS.md b/website_cookiefirst/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..e746d79db8 --- /dev/null +++ b/website_cookiefirst/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- [Studio73](https://www.studio73.es): + - Ioan Galan \<\> +- [NICO SOLUTIONS - ENGINEERING & IT](https://www.nico-solutions.de): + - Nils Coenen diff --git a/website_cookiefirst/readme/DESCRIPTION.md b/website_cookiefirst/readme/DESCRIPTION.md new file mode 100644 index 0000000000..4bc0b70616 --- /dev/null +++ b/website_cookiefirst/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +This module integrates Odoo website with GDPR through the functionality +of Cookiefirst (https://cookiefirst.com), you need to register your +website domain in Cookiefirst's portal. diff --git a/website_cookiefirst/static/description/icon.png b/website_cookiefirst/static/description/icon.png new file mode 100644 index 0000000000..818c6ac914 Binary files /dev/null and b/website_cookiefirst/static/description/icon.png differ diff --git a/website_cookiefirst/static/description/index.html b/website_cookiefirst/static/description/index.html new file mode 100644 index 0000000000..3886530c12 --- /dev/null +++ b/website_cookiefirst/static/description/index.html @@ -0,0 +1,449 @@ + + + + + +Website Cookiefirst + + + +
+

Website Cookiefirst

+ + +

Beta License: AGPL-3 OCA/website Translate me on Weblate Try me on Runboat

+

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

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Website > Configuration > Settings
  2. +
  3. Search ‘Cookiefirst’ option.
  4. +
  5. Fill in your ‘Cookiefirst ID’ (e.g. +‘00000000-0000-0000-0000-000000000000’).
  6. +
  7. Click on “Save” button.
  8. +
+

⚠️ 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

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Studio73
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

This module is part of the OCA/website project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/website_cookiefirst/tests/__init__.py b/website_cookiefirst/tests/__init__.py new file mode 100644 index 0000000000..482667d890 --- /dev/null +++ b/website_cookiefirst/tests/__init__.py @@ -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 diff --git a/website_cookiefirst/tests/test_res_config_settings.py b/website_cookiefirst/tests/test_res_config_settings.py new file mode 100644 index 0000000000..1c6478068a --- /dev/null +++ b/website_cookiefirst/tests/test_res_config_settings.py @@ -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) diff --git a/website_cookiefirst/tests/test_website.py b/website_cookiefirst/tests/test_website.py new file mode 100644 index 0000000000..9b1679817c --- /dev/null +++ b/website_cookiefirst/tests/test_website.py @@ -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") diff --git a/website_cookiefirst/views/res_config_settings_views.xml b/website_cookiefirst/views/res_config_settings_views.xml new file mode 100644 index 0000000000..4f9d07cb70 --- /dev/null +++ b/website_cookiefirst/views/res_config_settings_views.xml @@ -0,0 +1,29 @@ + + + + + res.config.settings.view.form.inherit.cookiefirst + + res.config.settings + + + + + +
+
+
+
+
+
+
diff --git a/website_cookiefirst/views/website_template.xml b/website_cookiefirst/views/website_template.xml new file mode 100644 index 0000000000..7807c615fd --- /dev/null +++ b/website_cookiefirst/views/website_template.xml @@ -0,0 +1,28 @@ + + + + +