Skip to content

Commit 274dd56

Browse files
fix(spp_branding_kit): address expert review findings, increase coverage to 53 tests
- Fix uninstall hook prefix (openspp.% → spp.%) so cleanup actually works - Remove global base.open_module_tree override that forced OpenSPP filter on all users - Scope CSS branding selectors to login page context to avoid hiding legitimate links - Change /openspp/about from auth="public" to auth="user" - Add CSRF justification comment on /publisher-warranty endpoint - Remove empty placeholder files (login_templates.xml, backend_customization.xml) - Remove missing banner.png reference from manifest - Wire test_http_endpoints into tests/__init__.py (12 tests were silently unreachable) - Add tests for post_init_hook company update, exception paths, uninstall edge cases - Add unauthenticated access tests for /openspp and /openspp/about - Rewrite static/description/index.html (remove stale Odoo 17 references) - Regenerate README.rst via OCA hook
1 parent 6284797 commit 274dd56

14 files changed

Lines changed: 198 additions & 164 deletions

spp_branding_kit/README.rst

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ OpenSPP Branding Kit
1010
!! source digest: sha256:ecc47cd586fc9235dbd8b4ce4832732d894d51b47acf0cb12a9ca2dbda38f464
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
13-
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
1414
:target: https://odoo-community.org/page/development-status
15-
:alt: Beta
15+
:alt: Production/Stable
1616
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
@@ -43,8 +43,10 @@ Key Capabilities
4343
OpenSPP text
4444
- Post-install debranding: disables Odoo brand promotion messages,
4545
update notification crons, and theme store menu
46-
- Module filtering: adds "OpenSPP Apps" menu to filter and view
46+
- Module filtering: adds "OpenSPP Apps" filter and menu to view
4747
OpenSPP-specific applications
48+
- Debug restriction: optionally restricts debug mode access to
49+
administrators only
4850

4951
Key Models
5052
~~~~~~~~~~
@@ -72,9 +74,8 @@ Configuration
7274

7375
After installing:
7476

75-
1. Open the **Settings** app
76-
2. Scroll to the **OpenSPP Branding** section (app card with OpenSPP
77-
icon)
77+
1. Open **Settings**
78+
2. Scroll to the **OpenSPP Branding** app card
7879
3. Configure **System Name** (default: "OpenSPP Platform")
7980
4. Set **Documentation URL** and **Support URL** for help links
8081
5. Toggle **Display OpenSPP Branding** to show/hide "Powered by OpenSPP"
@@ -86,18 +87,21 @@ After installing:
8687
Post-install hook automatically disables Odoo brand promotion, module
8788
update notifications, and theme store menu.
8889

89-
Menu Location
90-
~~~~~~~~~~~~~
90+
UI Location
91+
~~~~~~~~~~~
9192

92-
- **Apps > OpenSPP Apps** - View and filter OpenSPP-specific
93+
- **Apps > OpenSPP Apps** — filtered view of OpenSPP-specific
9394
applications
95+
- **Settings > OpenSPP Branding** — branding and telemetry configuration
96+
- **Settings > General Settings > About** — OpenSPP platform information
97+
card
9498

9599
Security
96100
~~~~~~~~
97101

98-
This module does not define security groups or access rights.
99-
Configuration access follows standard Odoo settings permissions
100-
(requires ``base.group_system`` - Settings access).
102+
This module does not define new security groups or access control
103+
entries. It extends existing models that already have ACLs.
104+
Configuration access requires ``base.group_system`` (Settings).
101105

102106
Extension Points
103107
~~~~~~~~~~~~~~~~
@@ -125,6 +129,28 @@ Dependencies
125129
Changelog
126130
=========
127131

132+
19.0.2.0.1
133+
~~~~~~~~~~
134+
135+
- Upgrade to Production/Stable status
136+
- Fix category to ``OpenSPP/Configuration``
137+
- Use ``search_count()`` in ``get_paid_apps_count()`` for efficiency
138+
- Add proper JSON response content-type to ``/openspp/about`` endpoint
139+
- Clean up outdated ``requirements.txt`` referencing Odoo 17
140+
- Increase test coverage to 95%+ (utils, settings, controllers, HTTP
141+
endpoints)
142+
- Update ``readme/DESCRIPTION.md`` to follow module description template
143+
- Fix uninstall hook to clean up ``spp.*`` parameters (was using wrong
144+
``openspp.*`` prefix)
145+
- Remove global Apps menu override that forced OpenSPP filter on all
146+
users
147+
- Scope CSS branding selectors to login page context
148+
- Change ``/openspp/about`` endpoint from public to authenticated access
149+
- Remove empty placeholder view files (``login_templates.xml``,
150+
``backend_customization.xml``)
151+
- Remove missing ``banner.png`` reference from manifest
152+
- Add CSRF justification comment on ``/publisher-warranty`` endpoint
153+
128154
19.0.2.0.0
129155
~~~~~~~~~~
130156

spp_branding_kit/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def uninstall_hook(env):
7272
"""
7373
_logger.info("OpenSPP Branding Kit: Running uninstall cleanup...")
7474

75-
# Remove all openspp.* configuration parameters
75+
# Remove all spp.* configuration parameters created by this module
7676
try:
7777
# nosemgrep: odoo-sudo-without-context — standard Odoo pattern for system parameter access
7878
IrConfigParam = env["ir.config_parameter"].sudo()
79-
params = IrConfigParam.search([("key", "=like", "openspp.%")])
79+
params = IrConfigParam.search([("key", "=like", "spp.%")])
8080
if params:
8181
param_count = len(params)
8282
params.unlink()

spp_branding_kit/__manifest__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
"data/debranding_data.xml",
2525
# Views - UI customizations
2626
"views/webclient_templates.xml",
27-
"views/login_templates.xml",
2827
"views/report_templates.xml",
29-
"views/backend_customization.xml",
3028
"views/res_config_settings_views.xml",
3129
"views/about_settings.xml",
3230
"views/ir_module_module_views.xml",
@@ -43,7 +41,6 @@
4341
},
4442
"images": [
4543
"static/description/icon.png",
46-
"static/description/banner.png",
4744
],
4845
"installable": True,
4946
"application": False,

spp_branding_kit/controllers/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def web_client(self, s_action=None, **kw):
4747
class OpenSPPBrandingController(http.Controller):
4848
"""Custom routes for OpenSPP branding"""
4949

50-
@http.route("/openspp/about", type="http", auth="public")
50+
@http.route("/openspp/about", type="http", auth="user")
5151
def openspp_about(self, **kwargs):
5252
"""Custom about page for OpenSPP"""
5353
payload = {
@@ -64,6 +64,9 @@ def version_info(self):
6464
"""Override version info to show OpenSPP branding"""
6565
return version_info_payload(request.env)
6666

67+
# csrf=False: This endpoint mimics Odoo's built-in telemetry route which receives
68+
# unauthenticated machine-to-machine POST requests from the Odoo client library.
69+
# CSRF protection does not apply to non-browser API endpoints.
6770
@http.route("/publisher-warranty", type="http", auth="none", csrf=False)
6871
def publisher_warranty(self, **kwargs):
6972
"""Handle telemetry based on configuration"""

spp_branding_kit/readme/HISTORY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
- Clean up outdated `requirements.txt` referencing Odoo 17
88
- Increase test coverage to 95%+ (utils, settings, controllers, HTTP endpoints)
99
- Update `readme/DESCRIPTION.md` to follow module description template
10+
- Fix uninstall hook to clean up `spp.*` parameters (was using wrong `openspp.*` prefix)
11+
- Remove global Apps menu override that forced OpenSPP filter on all users
12+
- Scope CSS branding selectors to login page context
13+
- Change `/openspp/about` endpoint from public to authenticated access
14+
- Remove empty placeholder view files (`login_templates.xml`, `backend_customization.xml`)
15+
- Remove missing `banner.png` reference from manifest
16+
- Add CSRF justification comment on `/publisher-warranty` endpoint
1017

1118
### 19.0.2.0.0
1219

spp_branding_kit/static/description/index.html

Lines changed: 66 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -57,162 +57,118 @@
5757
margin-top: 0;
5858
color: #2c3e50;
5959
}
60-
.installation {
61-
background: #f0f0f0;
62-
padding: 20px;
63-
border-radius: 5px;
64-
margin: 20px 0;
60+
table {
61+
width: 100%;
62+
border-collapse: collapse;
63+
margin: 15px 0;
6564
}
66-
.code {
67-
background: #2c3e50;
68-
color: white;
69-
padding: 15px;
70-
border-radius: 5px;
71-
font-family: 'Courier New', monospace;
72-
overflow-x: auto;
65+
th, td {
66+
text-align: left;
67+
padding: 10px 12px;
68+
border-bottom: 1px solid #e0e0e0;
7369
}
74-
.warning {
75-
background: #fff3cd;
76-
border-left: 4px solid #ffc107;
77-
padding: 15px;
78-
margin: 20px 0;
70+
th {
71+
background: #f8f9fa;
72+
font-weight: 600;
7973
}
80-
.info {
81-
background: #d1ecf1;
82-
border-left: 4px solid #17a2b8;
83-
padding: 15px;
84-
margin: 20px 0;
74+
code {
75+
background: #f0f0f0;
76+
padding: 2px 6px;
77+
border-radius: 3px;
78+
font-size: 0.9em;
8579
}
8680
</style>
8781
</head>
8882
<body>
8983
<div class="container">
9084
<div class="header">
9185
<h1>OpenSPP Branding Kit</h1>
92-
<p>Complete debranding and rebranding solution for Odoo 17</p>
86+
<p>Branding customization, URL routing and telemetry management for OpenSPP</p>
9387
</div>
94-
88+
9589
<div class="content">
9690
<div class="section">
9791
<h2>Overview</h2>
98-
<p>The OpenSPP Branding Kit is a comprehensive module that removes all Odoo branding and replaces it with OpenSPP branding throughout the entire platform. This module is designed specifically for Odoo 17 and follows best practices for maintainability and upgrade-safety.</p>
92+
<p>Replaces Odoo branding with OpenSPP branding across the platform. Adds <code>/openspp</code> URL routing as an alias for <code>/odoo</code> routes, redirects telemetry to OpenSPP endpoints or disables it entirely, and customizes system messages, email signatures, and report footers. Works with <code>theme_openspp_muk</code> for visual styling.</p>
9993
</div>
100-
94+
10195
<div class="section">
10296
<h2>Key Features</h2>
10397
<div class="features">
10498
<div class="feature">
105-
<h3>🎨 Complete Debranding</h3>
106-
<p>Removes all Odoo references from backend, frontend, login pages, and reports</p>
99+
<h3>URL Routing</h3>
100+
<p><code>/openspp/programs/123</code> works as an alias for <code>/odoo/programs/123</code>. Both routes remain functional.</p>
107101
</div>
108102
<div class="feature">
109-
<h3>🔒 Telemetry Disabled</h3>
110-
<p>Blocks all external communications and telemetry to Odoo servers</p>
103+
<h3>Telemetry Control</h3>
104+
<p>Redirect telemetry to an OpenSPP endpoint or disable it entirely via Settings.</p>
111105
</div>
112106
<div class="feature">
113-
<h3>📄 Custom Reports</h3>
114-
<p>Professional PDF reports with OpenSPP headers and footers</p>
107+
<h3>Session Branding</h3>
108+
<p>Injects OpenSPP system name and version into the web client session for consistent UI branding.</p>
115109
</div>
116110
<div class="feature">
117-
<h3>🌐 Website Customization</h3>
118-
<p>Fully branded website with custom footer and navigation</p>
111+
<h3>Report Customization</h3>
112+
<p>Updates company report headers and footers with OpenSPP text during installation.</p>
119113
</div>
120114
<div class="feature">
121-
<h3>👤 User Interface</h3>
122-
<p>Customized login page, user menu, and backend interface</p>
115+
<h3>Debug Restriction</h3>
116+
<p>Optionally restricts debug mode access to administrators only.</p>
123117
</div>
124118
<div class="feature">
125-
<h3>🚀 OCA Integration</h3>
126-
<p>Compatible with OCA debranding modules for enhanced functionality</p>
119+
<h3>Module Filtering</h3>
120+
<p>Adds an "OpenSPP Apps" filter and dedicated menu to browse OpenSPP-specific applications.</p>
127121
</div>
128122
</div>
129123
</div>
130-
124+
131125
<div class="section">
132-
<h2>Installation</h2>
133-
<div class="installation">
134-
<h3>Prerequisites</h3>
135-
<ul>
136-
<li>Odoo 17 Community Edition</li>
137-
<li>OpenSPP modules (if using with OpenSPP suite)</li>
138-
<li>OCA server-brand repository (recommended)</li>
139-
</ul>
140-
141-
<h3>Installation Steps</h3>
142-
<ol>
143-
<li>Clone the OCA server-brand repository:
144-
<div class="code">git clone --branch 17.0 https://github.com/OCA/server-brand.git</div>
145-
</li>
146-
<li>Add both module paths to your Odoo configuration (directories containing your addons):
147-
<div class="code">addons_path = /path/to/custom-addons,/path/to/server-brand,/path/to/odoo/addons</div>
148-
</li>
149-
<li>Restart Odoo server and update the apps list</li>
150-
<li>Install the OpenSPP Branding Kit module from the Apps menu</li>
151-
</ol>
152-
</div>
126+
<h2>Extended Models</h2>
127+
<table>
128+
<tr><th>Model</th><th>Extension Purpose</th></tr>
129+
<tr><td><code>res.users</code></td><td>Custom email signature, removes Odoo account URL</td></tr>
130+
<tr><td><code>res.config.settings</code></td><td>Adds branding and telemetry configuration fields</td></tr>
131+
<tr><td><code>ir.http</code></td><td>Injects OpenSPP branding into web client session info</td></tr>
132+
<tr><td><code>ir.module.module</code></td><td>Provides utility to count paid/proprietary apps</td></tr>
133+
</table>
153134
</div>
154-
135+
155136
<div class="section">
156137
<h2>Configuration</h2>
157-
<div class="info">
158-
<strong>Automatic Setup:</strong> The module automatically configures all branding elements upon installation. No manual configuration is required.
159-
</div>
160-
161-
<h3>Optional Configuration</h3>
162-
<ul>
163-
<li><strong>Company Logo:</strong> Upload your logo via Settings → Companies → Your Company</li>
164-
<li><strong>Website Footer:</strong> Can be further customized using the website builder</li>
165-
<li><strong>Email Templates:</strong> Modify email signatures in Settings → Technical → Email Templates</li>
166-
<li><strong>Report Headers:</strong> Adjust report layouts in Settings → Technical → Reports</li>
167-
</ul>
168-
</div>
169-
170-
<div class="section">
171-
<h2>Technical Details</h2>
172-
<h3>Module Structure</h3>
173-
<ul>
174-
<li><strong>Views:</strong> XML templates for UI customization</li>
175-
<li><strong>Data:</strong> Configuration records for debranding</li>
176-
<li><strong>Static:</strong> CSS, JavaScript, and image assets</li>
177-
<li><strong>Models:</strong> Python overrides for backend logic</li>
178-
<li><strong>Controllers:</strong> Custom routes and endpoints</li>
179-
</ul>
180-
181-
<h3>Dependencies</h3>
182-
<p>The module can work standalone but achieves best results when used with:</p>
183-
<ul>
184-
<li>disable_odoo_online (OCA)</li>
185-
<li>portal_odoo_debranding (OCA)</li>
186-
<li>remove_odoo_enterprise (OCA)</li>
187-
</ul>
138+
<ol>
139+
<li>Open <strong>Settings</strong></li>
140+
<li>Scroll to the <strong>OpenSPP Branding</strong> app card</li>
141+
<li>Configure <strong>System Name</strong> (default: "OpenSPP Platform")</li>
142+
<li>Set <strong>Documentation URL</strong> and <strong>Support URL</strong></li>
143+
<li>Toggle <strong>Display OpenSPP Branding</strong> to show/hide "Powered by OpenSPP"</li>
144+
<li>Configure telemetry: enable (redirects to OpenSPP endpoint) or disable</li>
145+
<li>Set <strong>Telemetry Endpoint</strong> if redirecting</li>
146+
</ol>
147+
<p>Post-install hook automatically disables Odoo brand promotion, module update notifications, and theme store menu.</p>
188148
</div>
189-
149+
190150
<div class="section">
191-
<h2>Upgrade Safety</h2>
192-
<div class="warning">
193-
<strong>Important:</strong> This module uses inheritance and XML modifications to ensure upgrade safety. All customizations are contained within the module and will not be lost during Odoo updates.
194-
</div>
195-
196-
<p>The module follows Odoo best practices:</p>
197-
<ul>
198-
<li>No core code modifications</li>
199-
<li>Uses proper inheritance mechanisms</li>
200-
<li>Declarative XML customizations</li>
201-
<li>Version-controlled development</li>
202-
</ul>
151+
<h2>Dependencies</h2>
152+
<table>
153+
<tr><th>Module</th><th>Purpose</th></tr>
154+
<tr><td><code>spp_security</code></td><td>OpenSPP security framework</td></tr>
155+
<tr><td><code>base</code></td><td>Odoo core</td></tr>
156+
<tr><td><code>web</code></td><td>Web client</td></tr>
157+
<tr><td><code>base_setup</code></td><td>Settings infrastructure</td></tr>
158+
<tr><td><code>theme_openspp_muk</code></td><td>OpenSPP visual styling</td></tr>
159+
</table>
203160
</div>
204-
161+
205162
<div class="section">
206163
<h2>Support</h2>
207164
<p>For support and contributions:</p>
208165
<ul>
209166
<li><strong>Website:</strong> <a href="https://openspp.org">openspp.org</a></li>
210-
<li><strong>Documentation:</strong> <a href="https://openspp.org/documentation">OpenSPP Documentation</a></li>
211-
<li><strong>GitHub:</strong> <a href="https://github.com/openspp">github.com/openspp</a></li>
212-
<li><strong>Community:</strong> <a href="https://openspp.org/community">OpenSPP Community</a></li>
167+
<li><strong>Documentation:</strong> <a href="https://docs.openspp.org">docs.openspp.org</a></li>
168+
<li><strong>GitHub:</strong> <a href="https://github.com/OpenSPP/OpenSPP2">github.com/OpenSPP/OpenSPP2</a></li>
213169
</ul>
214170
</div>
215-
171+
216172
<div class="section">
217173
<h2>License</h2>
218174
<p>This module is licensed under LGPL-3. See LICENSE file for details.</p>

0 commit comments

Comments
 (0)