Backend improvements: views, fields_get, session, RPC stubs
- Improved auto-generated list/form/search views with priority fields, two-column form layout, statusbar widget, notebook for O2M fields - Enhanced fields_get with currency_field, compute, related metadata - Fixed session handling: handleSessionInfo/handleSessionCheck use real session from cookie instead of hardcoded values - Added read_progress_bar and activity_format RPC stubs - Improved bootstrap translations with lang_parameters - Added "contacts" to session modules list Server starts successfully: 14 modules, 93 models, 378 XML templates, 503 JS modules transpiled — all from local frontend/ directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,16 +5,28 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// handleSessionCheck returns null (session is valid if middleware passed).
|
||||
// handleSessionCheck verifies the session is valid and returns session info.
|
||||
func (s *Server) handleSessionCheck(w http.ResponseWriter, r *http.Request) {
|
||||
s.writeJSONRPC(w, nil, nil, nil)
|
||||
sess := GetSession(r)
|
||||
if sess == nil {
|
||||
if cookie, err := r.Cookie("session_id"); err == nil && cookie.Value != "" {
|
||||
sess = s.sessions.Get(cookie.Value)
|
||||
}
|
||||
}
|
||||
if sess == nil {
|
||||
s.writeJSONRPC(w, nil, nil, &RPCError{
|
||||
Code: 100, Message: "Session expired",
|
||||
})
|
||||
return
|
||||
}
|
||||
s.writeJSONRPC(w, nil, s.buildSessionInfo(sess), nil)
|
||||
}
|
||||
|
||||
// handleSessionModules returns installed module names.
|
||||
func (s *Server) handleSessionModules(w http.ResponseWriter, r *http.Request) {
|
||||
s.writeJSONRPC(w, nil, []string{
|
||||
"base", "web", "account", "sale", "stock", "purchase",
|
||||
"hr", "project", "crm", "fleet", "l10n_de", "product",
|
||||
"base", "web", "contacts", "sale", "account", "stock",
|
||||
"purchase", "crm", "hr", "project", "fleet", "product", "l10n_de",
|
||||
}, nil)
|
||||
}
|
||||
|
||||
@@ -37,8 +49,17 @@ func (s *Server) handleManifest(w http.ResponseWriter, r *http.Request) {
|
||||
// handleBootstrapTranslations returns empty translations for initial boot.
|
||||
func (s *Server) handleBootstrapTranslations(w http.ResponseWriter, r *http.Request) {
|
||||
s.writeJSONRPC(w, nil, map[string]interface{}{
|
||||
"lang": "en_US",
|
||||
"hash": "empty",
|
||||
"lang": "en_US",
|
||||
"hash": "empty",
|
||||
"lang_parameters": map[string]interface{}{
|
||||
"direction": "ltr",
|
||||
"date_format": "%%m/%%d/%%Y",
|
||||
"time_format": "%%H:%%M:%%S",
|
||||
"grouping": "[3,0]",
|
||||
"decimal_point": ".",
|
||||
"thousands_sep": ",",
|
||||
"week_start": 1,
|
||||
},
|
||||
"modules": map[string]interface{}{},
|
||||
"multi_lang": false,
|
||||
}, nil)
|
||||
|
||||
Reference in New Issue
Block a user