How hexya-addons/web works
Project Type and Purpose
• This is a full-stack web client module (called “web”) for the Hexya framework.
• Backend: written in Go, exposing HTTP controllers, RPC endpoints, domain logic, i18n and an Odoo-proxy.
• Frontend: a rich JavaScript/CSS/QWeb application (borrowed from Odoo web client), organized into modules (core, chrome, fields, views, services, widgets).
High-Level Components
a. Browser-Side Application
• Static Assets Servered:
– JavaScript libraries and app code under static/src/js (core, chrome, fields, views, services, widgets)
– SCSS/CSS under static/src/scss
– QWeb XML templates under static/src/xml
– 3rd-party libs under static/lib
• Module Layers:
– Core services (ajax, rpc, session)
– UI chrome (menu, sidebar, root_widget)
– Field types, views (form, list, kanban, graph, calendar), widgets
– Data & state management (ram_storage, local_storage)
– Internationalization (i18n files)
b. Go Backend Server
• Entry point in 000hexya.go, client/client.go
• HTTP Controllers under controllers/ (login, session, assets, proxy, webclient, dataset, binary, model_calls, etc.)
• Domain logic under domains/ and company.go, user.go
• Security, filters, mixins, session management
• Odoo RPC proxy module (odooproxy/) forwarding calls to an Odoo instance
• Resources definitions (XML) under resources/
• Build & config: go.mod, .travis.yml, run_tests.sh, scripts/i18nUpdate.go
c. External Dependencies
• Odoo backend (via proxy)
• Browser loads external JS/CSS libs (jQuery, Bootstrap, ace editor, Chart.js, pdfjs, etc.)
• No direct database connection in this module; domain data managed via Hexya ORM elsewhere.
Relationships and Data Flows
• Browser → HTTP Server:
• Initial page load & asset download (controllers/assets)
• AJAX/RPC calls (controllers/model_calls, dataset, binary…)
• HTTP Server → Domain Layer:
• Controllers invoke domain functions (domains/domains.go)
• Security & session middleware enforce access
• HTTP Server → Odoo:
• Proxy controller forwards certain RPCs to an external Odoo server
• Browser Internal:
• JS UI modules communicate via rpc.ajax→backend, update models in RAM/local storage, render views with QWeb
Architectural Patterns & Design Principles
• MVC on both sides:
• Backend: Controllers → Domains (Models) → Templates/JSON
• Frontend: Models (ram_storage/local_storage) → Controllers (basic_controller) → Views/Renderers
• Service-oriented frontend with decoupled modules and event bus (bus.js)
• Single Page Application (SPA) style with dynamic view switching
• Internationalization via .po files loaded server-side then used in JS