← Back to Pull requests

[17.0][ADD] web_report_pdf_preview: Preview PDF reports in a dialog #1248

Open
unknown opened this pull request with 164 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 29, 2026 21:05 UTC
Author

@BInhexTeam

T26853

This module adds a Preview PDF option to PDF reports, unchecked by default. When it is checked, printing the report opens the PDF in a dialog with the Odoo PDF viewer instead of downloading it.

How it works

  • The option is in the report form, below Paper Format, and is only visible for PDF reports.

  • pdf_preview travels with the report action, from report_action() and _get_readable_fields(), so the client makes no extra call to know it.

  • A handler in the ir.actions.report handlers registry checks wkhtmltopdf as the standard download does, fetches the PDF once from /report/pdf/... with the user context merged with the action context, and shows it in a Dialog with pdf.js.

  • Open in new tab opens the same PDF (a blob: URL) in the browser viewer without generating it again. Closing the dialog releases it.

  • When the report comes from a wizard with close_on_report_download, the wizard is closed, as after a download.

  • In the viewer, Open file and Bookmark are hidden. Print and Download stay visible on mobile devices too, so the PDF can be printed there without downloading it.
  • Known issues

  • The Download button of the PDF viewer saves the file with the name the viewer gives to the PDF in memory, not with the report name.
  • Diff: 164 lines (+123 / -41) across 2 files Reviewer: rrebollo Review duration: 1882m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 164 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.305
    Real PR Conversation Timeline
    1 comments
    "Review active on #1248"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35% (MEDIUM) · Higher = larger blast radius
    35%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.6% · Safe to merge
    18.6%