- 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>
337 lines
11 KiB
Go
337 lines
11 KiB
Go
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, 2, 3, 4, 5, 6, 7, 8, 9},
|
|
"appID": false,
|
|
"xmlid": "",
|
|
"actionID": false,
|
|
"actionModel": false,
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Contacts
|
|
"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,
|
|
},
|
|
// Invoicing
|
|
"2": map[string]interface{}{
|
|
"id": 2,
|
|
"name": "Invoicing",
|
|
"children": []int{20},
|
|
"appID": 2,
|
|
"xmlid": "account.menu_finance",
|
|
"actionID": 2,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-book,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"20": map[string]interface{}{
|
|
"id": 20,
|
|
"name": "Invoices",
|
|
"children": []int{},
|
|
"appID": 2,
|
|
"xmlid": "account.menu_finance_invoices",
|
|
"actionID": 2,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Sales
|
|
"3": map[string]interface{}{
|
|
"id": 3,
|
|
"name": "Sales",
|
|
"children": []int{30},
|
|
"appID": 3,
|
|
"xmlid": "sale.menu_sale_root",
|
|
"actionID": 3,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-bar-chart,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"30": map[string]interface{}{
|
|
"id": 30,
|
|
"name": "Orders",
|
|
"children": []int{},
|
|
"appID": 3,
|
|
"xmlid": "sale.menu_sale_orders",
|
|
"actionID": 3,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// CRM
|
|
"4": map[string]interface{}{
|
|
"id": 4,
|
|
"name": "CRM",
|
|
"children": []int{40},
|
|
"appID": 4,
|
|
"xmlid": "crm.menu_crm_root",
|
|
"actionID": 4,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-star,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"40": map[string]interface{}{
|
|
"id": 40,
|
|
"name": "Pipeline",
|
|
"children": []int{},
|
|
"appID": 4,
|
|
"xmlid": "crm.menu_crm_pipeline",
|
|
"actionID": 4,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Inventory / Stock
|
|
"5": map[string]interface{}{
|
|
"id": 5,
|
|
"name": "Inventory",
|
|
"children": []int{50, 51},
|
|
"appID": 5,
|
|
"xmlid": "stock.menu_stock_root",
|
|
"actionID": 5,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-cubes,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"50": map[string]interface{}{
|
|
"id": 50,
|
|
"name": "Transfers",
|
|
"children": []int{},
|
|
"appID": 5,
|
|
"xmlid": "stock.menu_stock_transfers",
|
|
"actionID": 5,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"51": map[string]interface{}{
|
|
"id": 51,
|
|
"name": "Products",
|
|
"children": []int{},
|
|
"appID": 5,
|
|
"xmlid": "stock.menu_stock_products",
|
|
"actionID": 6,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Purchase
|
|
"6": map[string]interface{}{
|
|
"id": 6,
|
|
"name": "Purchase",
|
|
"children": []int{60},
|
|
"appID": 6,
|
|
"xmlid": "purchase.menu_purchase_root",
|
|
"actionID": 7,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-shopping-cart,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"60": map[string]interface{}{
|
|
"id": 60,
|
|
"name": "Purchase Orders",
|
|
"children": []int{},
|
|
"appID": 6,
|
|
"xmlid": "purchase.menu_purchase_orders",
|
|
"actionID": 7,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Employees / HR
|
|
"7": map[string]interface{}{
|
|
"id": 7,
|
|
"name": "Employees",
|
|
"children": []int{70, 71},
|
|
"appID": 7,
|
|
"xmlid": "hr.menu_hr_root",
|
|
"actionID": 8,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-users,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"70": map[string]interface{}{
|
|
"id": 70,
|
|
"name": "Employees",
|
|
"children": []int{},
|
|
"appID": 7,
|
|
"xmlid": "hr.menu_hr_employees",
|
|
"actionID": 8,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"71": map[string]interface{}{
|
|
"id": 71,
|
|
"name": "Departments",
|
|
"children": []int{},
|
|
"appID": 7,
|
|
"xmlid": "hr.menu_hr_departments",
|
|
"actionID": 9,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Project
|
|
"8": map[string]interface{}{
|
|
"id": 8,
|
|
"name": "Project",
|
|
"children": []int{80, 81},
|
|
"appID": 8,
|
|
"xmlid": "project.menu_project_root",
|
|
"actionID": 10,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-puzzle-piece,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"80": map[string]interface{}{
|
|
"id": 80,
|
|
"name": "Projects",
|
|
"children": []int{},
|
|
"appID": 8,
|
|
"xmlid": "project.menu_projects",
|
|
"actionID": 10,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"81": map[string]interface{}{
|
|
"id": 81,
|
|
"name": "Tasks",
|
|
"children": []int{},
|
|
"appID": 8,
|
|
"xmlid": "project.menu_project_tasks",
|
|
"actionID": 11,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
// Fleet
|
|
"9": map[string]interface{}{
|
|
"id": 9,
|
|
"name": "Fleet",
|
|
"children": []int{90},
|
|
"appID": 9,
|
|
"xmlid": "fleet.menu_fleet_root",
|
|
"actionID": 12,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": "fa-car,#71639e,#FFFFFF",
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
"90": map[string]interface{}{
|
|
"id": 90,
|
|
"name": "Vehicles",
|
|
"children": []int{},
|
|
"appID": 9,
|
|
"xmlid": "fleet.menu_fleet_vehicles",
|
|
"actionID": 12,
|
|
"actionModel": "ir.actions.act_window",
|
|
"actionPath": false,
|
|
"webIcon": nil,
|
|
"webIconData": nil,
|
|
"webIconDataMimetype": nil,
|
|
"backgroundImage": nil,
|
|
},
|
|
}
|
|
|
|
json.NewEncoder(w).Encode(menus)
|
|
}
|