[T1523] - ADD: Preview PDF button on communication job - #2125
Merged
Conversation
The existing Preview button only rendered raw HTML, never the actual PDF report, so a broken image (a positioning/CSS bug, or a static asset that fails to load) could go unnoticed until physical printing. Add a Preview PDF button that renders through the real ir.actions.report action instead.
Confidence Score: 5/5Safe to merge; no blocking failure remains. The changed preview action was executed through a focused harness using the method extracted from the repository source. It preserved the partner language, returned the report action for the selected job, and set the physical-printer bypass context.
What T-Rex did
Reviews (2): Last reviewed commit: "[T1523] FIX: Preview PDF must not reach ..." | Re-trigger Greptile |
preview_pdf_report() called report_action() without must_skip_send_to_printer=True, so previewing a report configured through base_report_to_printer for physical printing produced a real printer job instead of just serving the PDF to the browser.
ecino
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
T1523 — Country map/photo missing on German and Italian onboarding cards
Related PR: CompassionCH/compassion-switzerland#1783
Original report
The "sponsorship onboarding photo by post" physical communication (Sponsorship > Partner communication > Photo by card) should print a photo alongside the letter, but it only appears on French cards. It's also missing on Italian, so cards are currently being sent without it as a workaround.
Root cause
The QWeb report template (
onboarding_photo_by_post.xml,partner_communication_switzerland) embeds its layout CSS as literal text inside<t t-set="custom_css">. Odoo's translation extraction treats that raw CSS text as translatable, and the German and Italian.potranslations had the CSS property names themselves mistranslated —width→Breite/larghezza,height→Höhe/altezza,position→Position: absolut/posizione: assoluta,color→Farbe/colore. That makes the#mappositioning rule invalid CSS for German/Italian only, so the photo has no size/position and effectively vanishes. French's translation wasn't corrupted, which is why only French worked.The same corruption exists identically in both the v14 and v18
i18n/de.po/it.pofiles — pre-existing, not introduced by the v14→v18 migration itself.Separately (not a bug, confirmed intentional): the image itself is a circular community photo, not a literal country map — the map was replaced by a photo in a 2024 change and stays that way.
What changed
Two repos:
compassion-switzerland,
partner_communication_switzerlandreport/onboarding_photo_by_post.xml: addedt-translation="off"to the<t t-set="custom_css">block so this CSS can never be mistranslated again.i18n/de.po/i18n/it.po: corrected the corrupted translation entries.migrations/18.0.1.1.1/post-migration.py: guarded DB fix intended to copy the Frencharch_dbtranslation intode_DE/it_IT. In practice this turned out to be a no-op —t-translation="off"alone, combined with the ordinary module-upgrade data reload, was already enough to normalizearch_dbacross all installed languages (it collapses to one shared value, dropping the separatefr_CHkey entirely).compassion-modules,
partner_communication:_render_qweb_html) — never the actual PDF — so a broken/invisible image could go unnoticed until physical printing. The new button renders through the realir.actions.reportaction instead.How to test manually
partner_communication_switzerland(-u partner_communication_switzerland).report.urlsystem parameter to point at wherever the Odoo instance is actually being served from (http://127.0.0.1:<port>for local testing) — a stalereport.urlwill show a blank white square where the image should be.