-
-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] website_cookiefirst: Migration to 17.0
- Loading branch information
1 parent
4e479d1
commit a8acd92
Showing
8 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,11 @@ Contributors | |
|
||
- Ioan Galan <[email protected]> | ||
|
||
- `NICO SOLUTIONS - ENGINEERING & | ||
IT <https://www.nico-solutions.de>`__: | ||
|
||
- Nils Coenen [email protected] | ||
|
||
Maintainers | ||
----------- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |