From 41e6e0e75722a486c52c00a44428ff782693911b Mon Sep 17 00:00:00 2001 From: Milan Topuzov Date: Wed, 15 Oct 2025 09:07:04 +0200 Subject: [PATCH 1/6] [IMP] web_odoo_debrand: remove 'Odoo' title fallback and add tests\n\n- QWeb inherit replaces fallback with empty string\n- Added tests: about section removed, title fallback behavior\n- Dropped dialog debranding asset and file --- web_odoo_debrand/__init__.py | 3 + web_odoo_debrand/__manifest__.py | 18 ++++++ web_odoo_debrand/pyproject.toml | 3 + web_odoo_debrand/tests/__init__.py | 12 ++++ web_odoo_debrand/tests/test_title_debrand.py | 58 +++++++++++++++++++ .../tests/test_web_odoo_debrand.py | 27 +++++++++ .../views/res_config_settings_debrand.xml | 13 +++++ web_odoo_debrand/views/web_layout_debrand.xml | 10 ++++ 8 files changed, 144 insertions(+) create mode 100644 web_odoo_debrand/__init__.py create mode 100644 web_odoo_debrand/__manifest__.py create mode 100644 web_odoo_debrand/pyproject.toml create mode 100644 web_odoo_debrand/tests/__init__.py create mode 100644 web_odoo_debrand/tests/test_title_debrand.py create mode 100644 web_odoo_debrand/tests/test_web_odoo_debrand.py create mode 100644 web_odoo_debrand/views/res_config_settings_debrand.xml create mode 100644 web_odoo_debrand/views/web_layout_debrand.xml diff --git a/web_odoo_debrand/__init__.py b/web_odoo_debrand/__init__.py new file mode 100644 index 00000000..74b33c60 --- /dev/null +++ b/web_odoo_debrand/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# Copyright 2025 Milan Topuzov (https://milantopuzov.dev) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). diff --git a/web_odoo_debrand/__manifest__.py b/web_odoo_debrand/__manifest__.py new file mode 100644 index 00000000..7f4d5cd8 --- /dev/null +++ b/web_odoo_debrand/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2025 Milan Topuzov (https://milantopuzov.dev) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "Web Debrand (Odoo)", + "summary": "Hide Odoo branding elements in web backend", + "version": "19.0.1.0.0", + "category": "Hidden", + "website": "https://github.com/OCA/server-brand", + "author": "Milan Topuzov (https://milantopuzov.dev)", + "license": "LGPL-3", + "depends": ["web", "base_setup"], + "data": [ + "views/res_config_settings_debrand.xml", + "views/web_layout_debrand.xml", + ], + "assets": {}, + "installable": True, +} diff --git a/web_odoo_debrand/pyproject.toml b/web_odoo_debrand/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/web_odoo_debrand/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_odoo_debrand/tests/__init__.py b/web_odoo_debrand/tests/__init__.py new file mode 100644 index 00000000..4eeb86ad --- /dev/null +++ b/web_odoo_debrand/tests/__init__.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +"""Tests package for web_odoo_debrand. + +This package follows the same pattern as other modules in this repo, +importing local test modules so Odoo test discovery can load them. +""" + +# Copyright 2025 Milan Topuzov (https://milantopuzov.dev) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import test_web_odoo_debrand +from . import test_title_debrand diff --git a/web_odoo_debrand/tests/test_title_debrand.py b/web_odoo_debrand/tests/test_title_debrand.py new file mode 100644 index 00000000..e319b1f3 --- /dev/null +++ b/web_odoo_debrand/tests/test_title_debrand.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2025 Milan Topuzov (https://milantopuzov.dev) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from lxml import html + +from odoo.tests import common +from odoo import http + + +class _DummyRequest: + class _Session: + def __init__(self, debug=""): + self.debug = debug + + def __init__(self, debug=""): + # Minimal session object with a 'debug' attribute + self.session = self._Session(debug=debug) + + def csrf_token(self, _): + # Minimal CSRF call used by web.layout + return "" + + +class TestWebOdooDebrandTitle(common.TransactionCase): + def setUp(self): + super().setUp() + # Bind a dummy request into the http local stack so that the + # `odoo.http.request` LocalProxy resolves during QWeb evaluation. + self._dummy_request = _DummyRequest() + http._request_stack.push(self._dummy_request) + self.addCleanup(lambda: http._request_stack.pop()) + + def test_web_layout_title_no_fallback(self): + """web.layout should not fallback to 'Odoo' when no title is provided. + + Our view inherit replaces the <title> fallback with an empty string. + Validate that the rendered document title is empty and contains no 'Odoo'. + """ + content = self.env["ir.ui.view"]._render_template("web.layout", values={}) + doc = html.fromstring(content) + titles = doc.xpath("//title") + self.assertTrue(titles, "Rendered web.layout should contain a <title> tag") + title_text = (titles[0].text or "").strip() + self.assertEqual(title_text, "") + self.assertNotIn("Odoo", title_text) + + def test_web_layout_title_with_value(self): + """When a title value is provided, it should be rendered as-is.""" + expected = "My Custom Title" + content = self.env["ir.ui.view"]._render_template( + "web.layout", values={"title": expected} + ) + doc = html.fromstring(content) + titles = doc.xpath("//title") + self.assertTrue(titles, "Rendered web.layout should contain a <title> tag") + title_text = (titles[0].text or "").strip() + self.assertEqual(title_text, expected) diff --git a/web_odoo_debrand/tests/test_web_odoo_debrand.py b/web_odoo_debrand/tests/test_web_odoo_debrand.py new file mode 100644 index 00000000..be4eac86 --- /dev/null +++ b/web_odoo_debrand/tests/test_web_odoo_debrand.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Copyright 2025 Milan Topuzov (https://milantopuzov.dev) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from lxml import etree + +from odoo.tests import common + + +class TestWebOdooDebrand(common.TransactionCase): + def test_settings_about_section_removed(self): + """The About block in Settings form should be removed.""" + conf = self.env["res.config.settings"].create({}) + view = conf.get_views([[False, "form"]])["views"]["form"] + doc = etree.XML(view["arch"]) + + # Ensure the About container is no longer present + self.assertFalse( + doc.xpath("//div[@id='about']"), + "About section container should be removed from Settings form", + ) + + # Also ensure the edition widget from the About block is gone + self.assertFalse( + doc.xpath("//widget[@name='res_config_edition']"), + "Edition widget should be removed with the About section", + ) diff --git a/web_odoo_debrand/views/res_config_settings_debrand.xml b/web_odoo_debrand/views/res_config_settings_debrand.xml new file mode 100644 index 00000000..ba379f96 --- /dev/null +++ b/web_odoo_debrand/views/res_config_settings_debrand.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Remove the entire About section from General Settings --> + <record id="view_res_config_settings_debrand_about" model="ir.ui.view"> + <field name="name">res.config.settings.form.debrand.about</field> + <field name="model">res.config.settings</field> + <field name="inherit_id" ref="base_setup.res_config_settings_view_form"/> + <field name="arch" type="xml"> + <xpath expr="//div[@id='about']" position="replace"/> + </field> + </record> +</odoo> + diff --git a/web_odoo_debrand/views/web_layout_debrand.xml b/web_odoo_debrand/views/web_layout_debrand.xml new file mode 100644 index 00000000..e2a90ccc --- /dev/null +++ b/web_odoo_debrand/views/web_layout_debrand.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Remove default 'Odoo' fallback from page title --> + <template id="web_layout_debrand_title" inherit_id="web.layout" name="Web layout debrand title"> + <xpath expr="//title" position="replace"> + <title t-esc="title or ''"/> + </xpath> + </template> +</odoo> + From d9e045dd1acc2505f06d99bcdb0682df62b4cbe3 Mon Sep 17 00:00:00 2001 From: Milan Topuzov <milan.topuzov@salewise.io> Date: Wed, 15 Oct 2025 09:08:38 +0200 Subject: [PATCH 2/6] [IMP] web_odoo_debrand: pre-commit auto fixes --- web_odoo_debrand/__init__.py | 1 - web_odoo_debrand/tests/__init__.py | 1 - web_odoo_debrand/tests/test_title_debrand.py | 3 +-- web_odoo_debrand/tests/test_web_odoo_debrand.py | 1 - .../views/res_config_settings_debrand.xml | 7 +++---- web_odoo_debrand/views/web_layout_debrand.xml | 11 +++++++---- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/web_odoo_debrand/__init__.py b/web_odoo_debrand/__init__.py index 74b33c60..b02b8b5f 100644 --- a/web_odoo_debrand/__init__.py +++ b/web_odoo_debrand/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). diff --git a/web_odoo_debrand/tests/__init__.py b/web_odoo_debrand/tests/__init__.py index 4eeb86ad..c02e5f10 100644 --- a/web_odoo_debrand/tests/__init__.py +++ b/web_odoo_debrand/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Tests package for web_odoo_debrand. This package follows the same pattern as other modules in this repo, diff --git a/web_odoo_debrand/tests/test_title_debrand.py b/web_odoo_debrand/tests/test_title_debrand.py index e319b1f3..d69afa40 100644 --- a/web_odoo_debrand/tests/test_title_debrand.py +++ b/web_odoo_debrand/tests/test_title_debrand.py @@ -1,11 +1,10 @@ -# -*- coding: utf-8 -*- # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from lxml import html -from odoo.tests import common from odoo import http +from odoo.tests import common class _DummyRequest: diff --git a/web_odoo_debrand/tests/test_web_odoo_debrand.py b/web_odoo_debrand/tests/test_web_odoo_debrand.py index be4eac86..ed4981c4 100644 --- a/web_odoo_debrand/tests/test_web_odoo_debrand.py +++ b/web_odoo_debrand/tests/test_web_odoo_debrand.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). diff --git a/web_odoo_debrand/views/res_config_settings_debrand.xml b/web_odoo_debrand/views/res_config_settings_debrand.xml index ba379f96..7e8fcac0 100644 --- a/web_odoo_debrand/views/res_config_settings_debrand.xml +++ b/web_odoo_debrand/views/res_config_settings_debrand.xml @@ -1,13 +1,12 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <!-- Remove the entire About section from General Settings --> <record id="view_res_config_settings_debrand_about" model="ir.ui.view"> <field name="name">res.config.settings.form.debrand.about</field> <field name="model">res.config.settings</field> - <field name="inherit_id" ref="base_setup.res_config_settings_view_form"/> + <field name="inherit_id" ref="base_setup.res_config_settings_view_form" /> <field name="arch" type="xml"> - <xpath expr="//div[@id='about']" position="replace"/> + <xpath expr="//div[@id='about']" position="replace" /> </field> </record> </odoo> - diff --git a/web_odoo_debrand/views/web_layout_debrand.xml b/web_odoo_debrand/views/web_layout_debrand.xml index e2a90ccc..fcc13a1e 100644 --- a/web_odoo_debrand/views/web_layout_debrand.xml +++ b/web_odoo_debrand/views/web_layout_debrand.xml @@ -1,10 +1,13 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <!-- Remove default 'Odoo' fallback from page title --> - <template id="web_layout_debrand_title" inherit_id="web.layout" name="Web layout debrand title"> + <template + id="web_layout_debrand_title" + inherit_id="web.layout" + name="Web layout debrand title" + > <xpath expr="//title" position="replace"> - <title t-esc="title or ''"/> + <title t-esc="title or ''" /> </xpath> </template> </odoo> - From 6f8f3c45f41df560576cd53b59882b80e8fd41a2 Mon Sep 17 00:00:00 2001 From: Milan Topuzov <milan.topuzov@salewise.io> Date: Wed, 15 Oct 2025 09:14:21 +0200 Subject: [PATCH 3/6] [IMP] web_odoo_debrand: address pre-commit warnings\n\n- Add priority=100 to settings view replace\n- Switch QWeb title change to position=attributes\n- Add README.rst to satisfy pylint-odoo --- web_odoo_debrand/README.rst | 33 +++++++++++++++++++ web_odoo_debrand/__manifest__.py | 2 +- .../views/res_config_settings_debrand.xml | 1 + web_odoo_debrand/views/web_layout_debrand.xml | 4 +-- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 web_odoo_debrand/README.rst diff --git a/web_odoo_debrand/README.rst b/web_odoo_debrand/README.rst new file mode 100644 index 00000000..fd026361 --- /dev/null +++ b/web_odoo_debrand/README.rst @@ -0,0 +1,33 @@ +===================== +Web Debrand (Odoo) +===================== + +This addon removes selected Odoo branding elements in the web backend. + +- Removes the About block from General Settings. +- Blanks the default browser tab title fallback (no "Odoo"). + +Usage +----- + +Install the module and open Settings to verify the About section is gone. +Open the web client and check the browser tab title no longer defaults to "Odoo". + +Bug Tracker +----------- + +If you encounter problems, please open an issue in the repository. + +Credits +------- + +Authors +~~~~~~~ + +- Odoo Community Association (OCA) + +Maintainers +~~~~~~~~~~~ + +This module is part of the OCA/server-brand project. + diff --git a/web_odoo_debrand/__manifest__.py b/web_odoo_debrand/__manifest__.py index 7f4d5cd8..48253434 100644 --- a/web_odoo_debrand/__manifest__.py +++ b/web_odoo_debrand/__manifest__.py @@ -6,7 +6,7 @@ "version": "19.0.1.0.0", "category": "Hidden", "website": "https://github.com/OCA/server-brand", - "author": "Milan Topuzov (https://milantopuzov.dev)", + "author": "Odoo Community Association (OCA)", "license": "LGPL-3", "depends": ["web", "base_setup"], "data": [ diff --git a/web_odoo_debrand/views/res_config_settings_debrand.xml b/web_odoo_debrand/views/res_config_settings_debrand.xml index 7e8fcac0..ecfa3429 100644 --- a/web_odoo_debrand/views/res_config_settings_debrand.xml +++ b/web_odoo_debrand/views/res_config_settings_debrand.xml @@ -4,6 +4,7 @@ <record id="view_res_config_settings_debrand_about" model="ir.ui.view"> <field name="name">res.config.settings.form.debrand.about</field> <field name="model">res.config.settings</field> + <field name="priority" eval="100" /> <field name="inherit_id" ref="base_setup.res_config_settings_view_form" /> <field name="arch" type="xml"> <xpath expr="//div[@id='about']" position="replace" /> diff --git a/web_odoo_debrand/views/web_layout_debrand.xml b/web_odoo_debrand/views/web_layout_debrand.xml index fcc13a1e..d9975445 100644 --- a/web_odoo_debrand/views/web_layout_debrand.xml +++ b/web_odoo_debrand/views/web_layout_debrand.xml @@ -6,8 +6,8 @@ inherit_id="web.layout" name="Web layout debrand title" > - <xpath expr="//title" position="replace"> - <title t-esc="title or ''" /> + <xpath expr="//title" position="attributes"> + <attribute name="t-esc">title or ''</attribute> </xpath> </template> </odoo> From 5f5d066bba0f889f59e127775e4dd0b9222caf3e Mon Sep 17 00:00:00 2001 From: Milan Topuzov <milan.topuzov@salewise.io> Date: Wed, 15 Oct 2025 18:48:44 +0200 Subject: [PATCH 4/6] [REF] web_debranding: rename module and update references --- {web_odoo_debrand => web_debranding}/README.rst | 7 +++---- {web_odoo_debrand => web_debranding}/__init__.py | 0 {web_odoo_debrand => web_debranding}/__manifest__.py | 2 +- {web_odoo_debrand => web_debranding}/pyproject.toml | 0 {web_odoo_debrand => web_debranding}/tests/__init__.py | 4 ++-- .../tests/test_title_debranding.py | 2 +- .../tests/test_web_debranding.py | 2 +- .../views/res_config_settings_debrand.xml | 0 .../views/web_layout_debrand.xml | 0 9 files changed, 8 insertions(+), 9 deletions(-) rename {web_odoo_debrand => web_debranding}/README.rst (90%) rename {web_odoo_debrand => web_debranding}/__init__.py (100%) rename {web_odoo_debrand => web_debranding}/__manifest__.py (94%) rename {web_odoo_debrand => web_debranding}/pyproject.toml (100%) rename {web_odoo_debrand => web_debranding}/tests/__init__.py (79%) rename web_odoo_debrand/tests/test_title_debrand.py => web_debranding/tests/test_title_debranding.py (97%) rename web_odoo_debrand/tests/test_web_odoo_debrand.py => web_debranding/tests/test_web_debranding.py (94%) rename {web_odoo_debrand => web_debranding}/views/res_config_settings_debrand.xml (100%) rename {web_odoo_debrand => web_debranding}/views/web_layout_debrand.xml (100%) diff --git a/web_odoo_debrand/README.rst b/web_debranding/README.rst similarity index 90% rename from web_odoo_debrand/README.rst rename to web_debranding/README.rst index fd026361..bea58c79 100644 --- a/web_odoo_debrand/README.rst +++ b/web_debranding/README.rst @@ -1,6 +1,6 @@ -===================== -Web Debrand (Odoo) -===================== +================ +Web Debranding +================ This addon removes selected Odoo branding elements in the web backend. @@ -30,4 +30,3 @@ Maintainers ~~~~~~~~~~~ This module is part of the OCA/server-brand project. - diff --git a/web_odoo_debrand/__init__.py b/web_debranding/__init__.py similarity index 100% rename from web_odoo_debrand/__init__.py rename to web_debranding/__init__.py diff --git a/web_odoo_debrand/__manifest__.py b/web_debranding/__manifest__.py similarity index 94% rename from web_odoo_debrand/__manifest__.py rename to web_debranding/__manifest__.py index 48253434..8cdd6604 100644 --- a/web_odoo_debrand/__manifest__.py +++ b/web_debranding/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). { - "name": "Web Debrand (Odoo)", + "name": "Web Debranding", "summary": "Hide Odoo branding elements in web backend", "version": "19.0.1.0.0", "category": "Hidden", diff --git a/web_odoo_debrand/pyproject.toml b/web_debranding/pyproject.toml similarity index 100% rename from web_odoo_debrand/pyproject.toml rename to web_debranding/pyproject.toml diff --git a/web_odoo_debrand/tests/__init__.py b/web_debranding/tests/__init__.py similarity index 79% rename from web_odoo_debrand/tests/__init__.py rename to web_debranding/tests/__init__.py index c02e5f10..8bbf389e 100644 --- a/web_odoo_debrand/tests/__init__.py +++ b/web_debranding/tests/__init__.py @@ -1,4 +1,4 @@ -"""Tests package for web_odoo_debrand. +"""Tests package for web_debranding. This package follows the same pattern as other modules in this repo, importing local test modules so Odoo test discovery can load them. @@ -7,5 +7,5 @@ # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). -from . import test_web_odoo_debrand +from . import test_web_debranding from . import test_title_debrand diff --git a/web_odoo_debrand/tests/test_title_debrand.py b/web_debranding/tests/test_title_debranding.py similarity index 97% rename from web_odoo_debrand/tests/test_title_debrand.py rename to web_debranding/tests/test_title_debranding.py index d69afa40..28719100 100644 --- a/web_odoo_debrand/tests/test_title_debrand.py +++ b/web_debranding/tests/test_title_debranding.py @@ -21,7 +21,7 @@ def csrf_token(self, _): return "" -class TestWebOdooDebrandTitle(common.TransactionCase): +class TestWebDebrandingTitle(common.TransactionCase): def setUp(self): super().setUp() # Bind a dummy request into the http local stack so that the diff --git a/web_odoo_debrand/tests/test_web_odoo_debrand.py b/web_debranding/tests/test_web_debranding.py similarity index 94% rename from web_odoo_debrand/tests/test_web_odoo_debrand.py rename to web_debranding/tests/test_web_debranding.py index ed4981c4..0561ed87 100644 --- a/web_odoo_debrand/tests/test_web_odoo_debrand.py +++ b/web_debranding/tests/test_web_debranding.py @@ -6,7 +6,7 @@ from odoo.tests import common -class TestWebOdooDebrand(common.TransactionCase): +class TestWebDebranding(common.TransactionCase): def test_settings_about_section_removed(self): """The About block in Settings form should be removed.""" conf = self.env["res.config.settings"].create({}) diff --git a/web_odoo_debrand/views/res_config_settings_debrand.xml b/web_debranding/views/res_config_settings_debrand.xml similarity index 100% rename from web_odoo_debrand/views/res_config_settings_debrand.xml rename to web_debranding/views/res_config_settings_debrand.xml diff --git a/web_odoo_debrand/views/web_layout_debrand.xml b/web_debranding/views/web_layout_debrand.xml similarity index 100% rename from web_odoo_debrand/views/web_layout_debrand.xml rename to web_debranding/views/web_layout_debrand.xml From 995ada1cf128e18862f2a64f7ade9cb7beef29d0 Mon Sep 17 00:00:00 2001 From: Milan Topuzov <milan.topuzov@salewise.io> Date: Wed, 15 Oct 2025 18:53:42 +0200 Subject: [PATCH 5/6] [FIX] web_debranding: correct test import after file rename --- web_debranding/tests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_debranding/tests/__init__.py b/web_debranding/tests/__init__.py index 8bbf389e..2ff9942f 100644 --- a/web_debranding/tests/__init__.py +++ b/web_debranding/tests/__init__.py @@ -8,4 +8,4 @@ # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from . import test_web_debranding -from . import test_title_debrand +from . import test_title_debranding From c89f2f1caa0b25302a679e726137722a17b05bf9 Mon Sep 17 00:00:00 2001 From: Milan Topuzov <milan.topuzov@salewise.io> Date: Wed, 15 Oct 2025 19:18:27 +0200 Subject: [PATCH 6/6] [REF] web_debranding: hide Settings About block instead of replace; adjust tests --- web_debranding/tests/test_web_debranding.py | 20 ++++++++----------- .../views/res_config_settings_debrand.xml | 6 ++++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/web_debranding/tests/test_web_debranding.py b/web_debranding/tests/test_web_debranding.py index 0561ed87..ee09676c 100644 --- a/web_debranding/tests/test_web_debranding.py +++ b/web_debranding/tests/test_web_debranding.py @@ -7,20 +7,16 @@ class TestWebDebranding(common.TransactionCase): - def test_settings_about_section_removed(self): - """The About block in Settings form should be removed.""" + def test_settings_about_section_hidden(self): + """The About block in Settings form should be hidden.""" conf = self.env["res.config.settings"].create({}) view = conf.get_views([[False, "form"]])["views"]["form"] doc = etree.XML(view["arch"]) - # Ensure the About container is no longer present - self.assertFalse( - doc.xpath("//div[@id='about']"), - "About section container should be removed from Settings form", - ) - - # Also ensure the edition widget from the About block is gone - self.assertFalse( - doc.xpath("//widget[@name='res_config_edition']"), - "Edition widget should be removed with the About section", + about_nodes = doc.xpath("//div[@id='about']") + self.assertTrue(about_nodes, "About section container should exist in the view") + self.assertIn( + "invisible", + about_nodes[0].attrib, + "About section should be hidden via invisible='1'", ) diff --git a/web_debranding/views/res_config_settings_debrand.xml b/web_debranding/views/res_config_settings_debrand.xml index ecfa3429..aebfbbda 100644 --- a/web_debranding/views/res_config_settings_debrand.xml +++ b/web_debranding/views/res_config_settings_debrand.xml @@ -1,13 +1,15 @@ <?xml version="1.0" encoding="utf-8" ?> <odoo> - <!-- Remove the entire About section from General Settings --> + <!-- Hide the About section in General Settings --> <record id="view_res_config_settings_debrand_about" model="ir.ui.view"> <field name="name">res.config.settings.form.debrand.about</field> <field name="model">res.config.settings</field> <field name="priority" eval="100" /> <field name="inherit_id" ref="base_setup.res_config_settings_view_form" /> <field name="arch" type="xml"> - <xpath expr="//div[@id='about']" position="replace" /> + <xpath expr="//div[@id='about']" position="attributes"> + <attribute name="invisible">1</attribute> + </xpath> </field> </record> </odoo>