package server import ( "encoding/json" "net/http" ) // handleLoadMenus returns the menu tree for the webclient. // Mirrors: odoo/addons/web/controllers/home.py Home.web_load_menus() func (s *Server) handleLoadMenus(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.Header().Set("Cache-Control", "public, max-age=3600") // Build menu tree from database or hardcoded defaults menus := map[string]interface{}{ "root": map[string]interface{}{ "id": "root", "name": "root", "children": []int{1}, "appID": false, "xmlid": "", "actionID": false, "actionModel": false, "actionPath": false, "webIcon": nil, "webIconData": nil, "webIconDataMimetype": nil, "backgroundImage": nil, }, "1": map[string]interface{}{ "id": 1, "name": "Contacts", "children": []int{10}, "appID": 1, "xmlid": "contacts.menu_contacts", "actionID": 1, "actionModel": "ir.actions.act_window", "actionPath": false, "webIcon": "fa-address-book,#71639e,#FFFFFF", "webIconData": nil, "webIconDataMimetype": nil, "backgroundImage": nil, }, "10": map[string]interface{}{ "id": 10, "name": "Contacts", "children": []int{}, "appID": 1, "xmlid": "contacts.menu_contacts_list", "actionID": 1, "actionModel": "ir.actions.act_window", "actionPath": false, "webIcon": nil, "webIconData": nil, "webIconDataMimetype": nil, "backgroundImage": nil, }, } json.NewEncoder(w).Encode(menus) }