Skip to content

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

Open
edescalona wants to merge 1 commit into
OCA:17.0from
BinhexTeam:17.0-add-web_report_pdf_preview
Open

edescalona wants to merge 1 commit into
OCA:17.0from
BinhexTeam:17.0-add-web_report_pdf_preview

Conversation

@edescalona

@edescalona edescalona commented Nov 29, 2026 •

Copy link
Copy Markdown

@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.

Add a "Preview PDF" option to PDF reports. When it is set, printing the
report fetches the PDF once and shows it in a dialog with the Odoo PDF
viewer instead of downloading it. The dialog has an "Open in new tab"
button that opens the same PDF in the browser viewer without generating
it again.

Reports without the option, non-PDF reports, and the cases where
wkhtmltopdf is not usable or the server does not return a PDF keep the
standard download.
@OCA-git-bot OCA-git-bot added series:17.0 mod:web_report_pdf_preview Module web_report_pdf_preview labels Nov 29, 2026
@edescalona edescalona changed the title [ADD] web_report_pdf_preview: Preview PDF reports in a dialog [17.0][ADD] web_report_pdf_preview: Preview PDF reports in a dialog Nov 29, 2026
@edescalona
edescalona marked this pull request as ready for review November 29, 2026 21:10
@edescalona

Copy link
Copy Markdown
Author

Hi @rrebollo @jelenapoblet @pedrobaeza could you please review? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_report_pdf_preview Module web_report_pdf_preview series:17.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants