PDF reports + View inheritance + Pivot/Graph views

PDF Reports:
- /report/pdf/ endpoint with graceful degradation chain:
  wkhtmltopdf → headless Chrome/Chromium → HTML with window.print()
- Print-friendly CSS (@page A4, margins, page-break rules)
- ir.actions.report dispatch for client Print button

View Inheritance:
- loadViewArch now loads base + inheriting views (inherit_id)
- applyViewInheritance with XPath support:
  //field[@name='X'] and <field name="X" position="...">
- Positions: after, before, replace, inside
- XML parser for inherit directives using encoding/xml

New View Types:
- Pivot view auto-generation (numeric fields as measures)
- Graph view auto-generation (M2O/Selection + numeric measure)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc
2026-04-03 13:52:30 +02:00
parent 2e5a550069
commit e0d8bc81d3
4 changed files with 725 additions and 255 deletions

View File

@@ -129,9 +129,10 @@ func (s *Server) registerRoutes() {
// CSV export
s.mux.HandleFunc("/web/export/csv", s.handleExportCSV)
// Reports (HTML report rendering)
// Reports (HTML and PDF report rendering)
s.mux.HandleFunc("/report/", s.handleReport)
s.mux.HandleFunc("/report/html/", s.handleReport)
s.mux.HandleFunc("/report/pdf/", s.handleReportPDF)
// Logout & Account
s.mux.HandleFunc("/web/session/logout", s.handleLogout)
@@ -352,6 +353,19 @@ func (s *Server) dispatchORM(env *orm.Environment, params CallKWParams) (interfa
return nil, err
}
// Handle ir.actions.report RPC calls (e.g., Print button on invoices).
// Mirrors: odoo/addons/base/models/ir_actions_report.py IrActionsReport.report_action()
if params.Model == "ir.actions.report" && params.Method == "report_action" {
if len(params.Args) > 0 {
reportName, _ := params.Args[0].(string)
return map[string]interface{}{
"type": "ir.actions.report",
"report_name": reportName,
"report_type": "qweb-html",
}, nil
}
}
// If model is "ir.http", handle special routing methods
if params.Model == "ir.http" {
switch params.Method {