package server import ( "encoding/json" "net/http" ) // handleActionLoad loads an action definition by ID. // Mirrors: odoo/addons/web/controllers/action.py Action.load() func (s *Server) handleActionLoad(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) return } var req JSONRPCRequest if err := json.NewDecoder(r.Body).Decode(&req); err != nil { s.writeJSONRPC(w, nil, nil, &RPCError{Code: -32700, Message: "Parse error"}) return } var params struct { ActionID interface{} `json:"action_id"` Context interface{} `json:"context"` } json.Unmarshal(req.Params, ¶ms) // For now, return the Contacts action for any request // TODO: Load from ir_act_window table action := map[string]interface{}{ "id": 1, "type": "ir.actions.act_window", "name": "Contacts", "res_model": "res.partner", "view_mode": "list,form", "views": [][]interface{}{{nil, "list"}, {nil, "form"}}, "search_view_id": false, "domain": "[]", "context": "{}", "target": "current", "limit": 80, "help": "", "xml_id": "contacts.action_contacts", } s.writeJSONRPC(w, req.ID, action, nil) }