-
-
Notifications
You must be signed in to change notification settings - Fork 181
[19.0][ADD] web_debranding: add #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tishmen
wants to merge
6
commits into
OCA:19.0
Choose a base branch
from
tishmen:19.0-mig-web_odoo_debrand
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
41e6e0e
[IMP] web_odoo_debrand: remove 'Odoo' title fallback and add tests\n\…
d9e045d
[IMP] web_odoo_debrand: pre-commit auto fixes
6f8f3c4
[IMP] web_odoo_debrand: address pre-commit warnings\n\n- Add priority…
5f5d066
[REF] web_debranding: rename module and update references
995ada1
[FIX] web_debranding: correct test import after file rename
c89f2f1
[REF] web_debranding: hide Settings About block instead of replace; a…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,32 @@ | ||
| ================ | ||
| Web Debranding | ||
| ================ | ||
|
|
||
| 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. |
This file contains hidden or 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,2 @@ | ||
| # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) | ||
| # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). |
This file contains hidden or 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,18 @@ | ||
| # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) | ||
| # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
| { | ||
| "name": "Web Debranding", | ||
| "summary": "Hide Odoo branding elements in web backend", | ||
| "version": "19.0.1.0.0", | ||
| "category": "Hidden", | ||
| "website": "https://github.com/OCA/server-brand", | ||
| "author": "Odoo Community Association (OCA)", | ||
| "license": "LGPL-3", | ||
| "depends": ["web", "base_setup"], | ||
| "data": [ | ||
| "views/res_config_settings_debrand.xml", | ||
| "views/web_layout_debrand.xml", | ||
| ], | ||
| "assets": {}, | ||
| "installable": True, | ||
| } |
This file contains hidden or 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,3 @@ | ||
| [build-system] | ||
| requires = ["whool"] | ||
| build-backend = "whool.buildapi" |
This file contains hidden or 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,11 @@ | ||
| """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. | ||
| """ | ||
|
|
||
| # Copyright 2025 Milan Topuzov (https://milantopuzov.dev) | ||
| # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
|
||
| from . import test_web_debranding | ||
| from . import test_title_debranding |
This file contains hidden or 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,57 @@ | ||
| # 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 import http | ||
| from odoo.tests import common | ||
|
|
||
|
|
||
| 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 TestWebDebrandingTitle(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) |
This file contains hidden or 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,22 @@ | ||
| # 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 TestWebDebranding(common.TransactionCase): | ||
| 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"]) | ||
|
|
||
| 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'", | ||
| ) |
This file contains hidden or 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 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <odoo> | ||
| <!-- 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="attributes"> | ||
| <attribute name="invisible">1</attribute> | ||
| </xpath> | ||
| </field> | ||
| </record> | ||
| </odoo> |
This file contains hidden or 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,13 @@ | ||
| <?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="attributes"> | ||
| <attribute name="t-esc">title or ''</attribute> | ||
| </xpath> | ||
| </template> | ||
| </odoo> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.