Fix CSS loading: copy odoo_web.css to frontend, handle /odoo/ static paths
- Copy build/odoo_web.css to frontend/web/static/ so it's served correctly - Handle /odoo/<addon>/static/ paths in static file handler (strip odoo/ prefix) - Route /odoo/ paths with /static/ to static handler instead of webclient All CSS now loads correctly: Bootstrap, FontAwesome, Odoo UI icons, modules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
5
frontend/web/static/odoo_web.css
Normal file
5
frontend/web/static/odoo_web.css
Normal file
File diff suppressed because one or more lines are too long
BIN
odoo-server
BIN
odoo-server
Binary file not shown.
@@ -66,7 +66,14 @@ func (s *Server) registerRoutes() {
|
||||
s.mux.HandleFunc("/web", s.handleWebClient)
|
||||
s.mux.HandleFunc("/web/", s.handleWebRoute)
|
||||
s.mux.HandleFunc("/odoo", s.handleWebClient)
|
||||
s.mux.HandleFunc("/odoo/", s.handleWebClient)
|
||||
s.mux.HandleFunc("/odoo/", func(w http.ResponseWriter, r *http.Request) {
|
||||
// /odoo/base/static/... → serve static files
|
||||
if strings.Contains(r.URL.Path, "/static/") {
|
||||
s.handleStatic(w, r)
|
||||
return
|
||||
}
|
||||
s.handleWebClient(w, r)
|
||||
})
|
||||
|
||||
// Login page
|
||||
s.mux.HandleFunc("/web/login", s.handleLogin)
|
||||
|
||||
@@ -28,6 +28,12 @@ func (s *Server) handleStatic(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
path := strings.TrimPrefix(r.URL.Path, "/")
|
||||
|
||||
// Handle /odoo/<addon>/static/<path> → treat as /<addon>/static/<path>
|
||||
if strings.HasPrefix(path, "odoo/") {
|
||||
path = strings.TrimPrefix(path, "odoo/")
|
||||
}
|
||||
|
||||
parts := strings.SplitN(path, "/", 3)
|
||||
if len(parts) < 3 || parts[1] != "static" {
|
||||
http.NotFound(w, r)
|
||||
|
||||
Reference in New Issue
Block a user