Skip to content

Commit 4b2fe42

Browse files
committed
feat: add spp_branding_kit module for custom branding
1 parent 3ab7cfe commit 4b2fe42

31 files changed

+1888
-0
lines changed

spp_branding_kit/README.md

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
# OpenSPP Branding Kit for Odoo 17
2+
3+
A comprehensive debranding and rebranding module for Odoo 17 that replaces all Odoo branding with OpenSPP
4+
branding throughout the platform.
5+
6+
## Features
7+
8+
### Complete Debranding
9+
10+
- ✅ Removes "Powered by Odoo" messages from all interfaces
11+
- ✅ Eliminates Odoo.com links and references
12+
- ✅ Disables telemetry and external communications
13+
- ✅ Removes enterprise promotion elements
14+
- ✅ Hides app store and theme store links
15+
16+
### Custom Branding
17+
18+
- 🎨 Custom website footer with OpenSPP information
19+
- 🎨 Branded login page with OpenSPP styling
20+
- 🎨 Professional PDF reports with OpenSPP headers/footers
21+
- 🎨 Customized backend interface with OpenSPP colors
22+
- 🎨 Modified user menu with OpenSPP links
23+
- 🎨 Custom email signatures and templates
24+
25+
### Technical Features
26+
27+
- 🔧 Follows Odoo best practices for upgrade safety
28+
- 🔧 Uses proper inheritance mechanisms
29+
- 🔧 Compatible with OCA debranding modules
30+
- 🔧 Modular architecture for easy customization
31+
- 🔧 No core code modifications
32+
33+
## Requirements
34+
35+
- Odoo 17 Community Edition
36+
- Python 3.8+
37+
- PostgreSQL 12+
38+
39+
### Recommended OCA Modules
40+
41+
For complete debranding, install these modules from the
42+
[OCA/server-brand](https://github.com/OCA/server-brand) repository:
43+
44+
- `disable_odoo_online` (17.0.1.0.0)
45+
- `portal_odoo_debranding` (17.0.1.0.0)
46+
- `remove_odoo_enterprise` (17.0.1.0.1)
47+
48+
## Installation
49+
50+
### 1. Clone the Module
51+
52+
```bash
53+
cd /path/to/your/custom-addons
54+
git clone [repository-url] openspp_branding_kit
55+
```
56+
57+
### 2. Install OCA Dependencies (Recommended)
58+
59+
```bash
60+
cd /path/to/your/custom-addons
61+
git clone --branch 17.0 https://github.com/OCA/server-brand.git
62+
```
63+
64+
### 3. Update Odoo Configuration
65+
66+
Add the module paths to your `odoo.conf`:
67+
68+
```ini
69+
[options]
70+
addons_path = /path/to/openspp_branding_kit,/path/to/server-brand,/path/to/odoo/addons
71+
72+
# Recommended security settings
73+
list_db = False
74+
```
75+
76+
### 4. Install the Module
77+
78+
1. Restart your Odoo server
79+
2. Go to Apps menu
80+
3. Update Apps List
81+
4. Search for "OpenSPP Branding Kit"
82+
5. Click Install
83+
84+
## Configuration
85+
86+
The module automatically applies all branding changes upon installation. However, you can further customize:
87+
88+
### Company Information
89+
90+
- Navigate to Settings → Companies → Your Company
91+
- Update company logo, address, and contact information
92+
93+
### Website Customization
94+
95+
- Use the website builder to further customize the footer
96+
- Modify colors and styles through the Customize menu
97+
98+
### Email Templates
99+
100+
- Go to Settings → Technical → Email Templates
101+
- Modify the OpenSPP notification templates as needed
102+
103+
### Report Customization
104+
105+
- Navigate to Settings → Technical → Reports
106+
- Adjust paper formats and layouts
107+
108+
## Module Structure
109+
110+
```
111+
openspp_branding_kit/
112+
├── __manifest__.py # Module metadata
113+
├── __init__.py # Module initialization
114+
├── controllers/ # HTTP controllers
115+
│ └── main.py # Custom routes
116+
├── data/ # Data files
117+
│ ├── debranding_data.xml
118+
│ ├── ir_config_parameter.xml
119+
│ └── res_company_data.xml
120+
├── models/ # Model overrides
121+
│ ├── ir_http.py
122+
│ └── res_users.py
123+
├── security/ # Access control
124+
│ └── ir.model.access.csv
125+
├── static/ # Static assets
126+
│ ├── description/ # Module description
127+
│ └── src/ # CSS/JS assets
128+
│ ├── js/ # JavaScript files
129+
│ └── scss/ # SCSS stylesheets
130+
└── views/ # XML templates
131+
├── backend_customization.xml
132+
├── login_templates.xml
133+
├── report_templates.xml
134+
├── webclient_templates.xml
135+
└── website_templates.xml
136+
```
137+
138+
## Customization Guide
139+
140+
### Changing Colors
141+
142+
Edit the SCSS variables in `static/src/scss/backend.scss`:
143+
144+
```scss
145+
$openspp-primary: #2c3e50; // Main brand color
146+
$openspp-secondary: #34495e; // Secondary color
147+
$openspp-accent: #3498db; // Accent color
148+
```
149+
150+
### Modifying Footer Content
151+
152+
Edit `views/website_templates.xml` to change footer text and links.
153+
154+
### Adding Custom Logos
155+
156+
1. Place your logo in `static/description/`
157+
2. Update the path in `data/ir_config_parameter.xml`
158+
3. Reference it in templates
159+
160+
## Troubleshooting
161+
162+
### Module Not Appearing
163+
164+
- Ensure the module path is in `addons_path`
165+
- Check module permissions (should be readable)
166+
- Update apps list with `--update=all` flag
167+
168+
### Branding Not Applied
169+
170+
- Clear browser cache
171+
- Restart Odoo server
172+
- Check for conflicting modules
173+
174+
### OCA Modules Not Working
175+
176+
- Verify you're using the 17.0 branch
177+
- Check module dependencies are satisfied
178+
- Review Odoo logs for errors
179+
180+
## Development
181+
182+
### Running Tests
183+
184+
```bash
185+
./odoo-bin -c odoo.conf -d test_db --test-enable --stop-after-init -i openspp_branding_kit
186+
```
187+
188+
### Contributing
189+
190+
1. Fork the repository
191+
2. Create a feature branch
192+
3. Make your changes
193+
4. Add tests if applicable
194+
5. Submit a pull request
195+
196+
## Security Considerations
197+
198+
This module includes security enhancements:
199+
200+
- Disables database manager in web interface
201+
- Blocks telemetry to external servers
202+
- Removes potentially sensitive information from UI
203+
- Implements secure default configurations
204+
205+
## License
206+
207+
This module is licensed under LGPL-3. See LICENSE file for full details.
208+
209+
## Support
210+
211+
- **Website**: [https://openspp.org](https://openspp.org)
212+
- **Documentation**: [https://openspp.org/documentation](https://openspp.org/documentation)
213+
- **GitHub**: [https://github.com/openspp](https://github.com/openspp)
214+
- **Community**: [https://openspp.org/community](https://openspp.org/community)
215+
216+
## Credits
217+
218+
### Authors
219+
220+
- OpenSPP Project Team
221+
222+
### Contributors
223+
224+
- See contributors list on GitHub
225+
226+
### Acknowledgments
227+
228+
- Odoo Community Association (OCA) for debranding modules
229+
- OpenSPP community for testing and feedback
230+
231+
## Changelog
232+
233+
### Version 17.0.1.0.0 (Latest)
234+
235+
- Initial release for Odoo 17
236+
- Complete debranding functionality
237+
- OpenSPP branding implementation
238+
- OCA module compatibility
239+
- Security enhancements
240+
241+
---
242+
243+
© 2025 OpenSPP Project. All rights reserved.

spp_branding_kit/__init__.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# ABOUTME: Module initialization file for OpenSPP Branding Kit
2+
# ABOUTME: Imports models, controllers and defines hooks for the module
3+
4+
from . import models
5+
from . import controllers
6+
7+
import logging
8+
9+
_logger = logging.getLogger(__name__)
10+
11+
12+
def post_init_hook(env):
13+
"""
14+
Post-installation hook to perform initial branding setup
15+
"""
16+
_logger.info("OpenSPP Branding Kit: Running post-installation setup...")
17+
18+
# Set default configuration parameters
19+
try:
20+
IrConfigParam = env["ir.config_parameter"].sudo()
21+
22+
# Set hide paid apps to True by default (if not already set)
23+
if not IrConfigParam.get_param("openspp.hide_paid_apps"):
24+
IrConfigParam.set_param("openspp.hide_paid_apps", "True")
25+
_logger.info("Set hide paid apps to True by default")
26+
27+
# Set default app filter to 'apps_only' (if not already set)
28+
if not IrConfigParam.get_param("openspp.default_app_filter"):
29+
IrConfigParam.set_param("openspp.default_app_filter", "apps_only")
30+
_logger.info("Set default app filter to 'apps_only'")
31+
32+
except Exception as e:
33+
_logger.warning(f"Error setting default parameters: {e}")
34+
35+
# Disable Odoo branding elements
36+
try:
37+
# Deactivate brand promotion view
38+
brand_promotion = env.ref("web.brand_promotion_message", raise_if_not_found=False)
39+
if brand_promotion:
40+
brand_promotion.active = False
41+
_logger.info("Disabled Odoo brand promotion message")
42+
43+
# Disable update notification cron jobs (search by model/method)
44+
Cron = env["ir.cron"].sudo()
45+
46+
# Disable module update related cron jobs
47+
module_update_crons = Cron.search(
48+
[
49+
"|",
50+
"|",
51+
("model", "=", "ir.module.module"),
52+
("model", "=", "publisher_warranty.contract"),
53+
("cron_name", "ilike", "module"),
54+
]
55+
)
56+
for cron in module_update_crons:
57+
if cron.active:
58+
cron.active = False
59+
_logger.info(f"Disabled cron job: {cron.name}")
60+
61+
# Disable theme store menu if it exists
62+
theme_menu = env["ir.ui.menu"].sudo().search([("name", "ilike", "Theme Store")], limit=1)
63+
if theme_menu and theme_menu.active:
64+
theme_menu.active = False
65+
_logger.info("Disabled Theme Store menu")
66+
67+
except Exception as e:
68+
_logger.warning(f"Error during branding setup: {e}")
69+
70+
# Update company information
71+
try:
72+
Company = env["res.company"].sudo()
73+
main_company = Company.browse(1) # Main company
74+
if main_company.exists():
75+
main_company.write(
76+
{
77+
"report_header": "OpenSPP Platform",
78+
"report_footer": "OpenSPP - Open Source Social Protection Platform",
79+
"website": "https://openspp.org",
80+
}
81+
)
82+
_logger.info("Updated main company branding")
83+
except Exception as e:
84+
_logger.warning(f"Error updating company data: {e}")
85+
86+
_logger.info("OpenSPP Branding Kit: Post-installation setup completed")
87+
88+
89+
def uninstall_hook(env):
90+
"""
91+
Uninstall hook to clean up configuration parameters
92+
"""
93+
_logger.info("OpenSPP Branding Kit: Running uninstall cleanup...")
94+
95+
# Remove the hide_paid_apps parameter
96+
try:
97+
IrConfigParam = env["ir.config_parameter"].sudo()
98+
param = IrConfigParam.search([("key", "=", "openspp.hide_paid_apps")])
99+
if param:
100+
param.unlink()
101+
_logger.info("Removed hide_paid_apps parameter")
102+
except Exception as e:
103+
_logger.warning(f"Error removing configuration parameter: {e}")
104+
105+
# Optionally re-enable Odoo branding elements
106+
# This is commented out by default to maintain debranding even after uninstall
107+
# Uncomment if you want to restore Odoo branding on module removal
108+
109+
# try:
110+
# brand_promotion = env.ref('web.brand_promotion_message', raise_if_not_found=False)
111+
# if brand_promotion:
112+
# brand_promotion.active = True
113+
# except Exception as e:
114+
# _logger.warning(f"Error during uninstall cleanup: {e}")
115+
116+
_logger.info("OpenSPP Branding Kit: Uninstall cleanup completed")

0 commit comments

Comments
 (0)