Skip to content

T3434-FixChildpack - #2145

Merged
ecino merged 4 commits into
18.0from
T3434-FixChildpack
Sep 3, 2026
Merged

T3434-FixChildpack#2145
ecino merged 4 commits into
18.0from
T3434-FixChildpack

Conversation

@loris-fab

@loris-fab loris-fab commented Sep 2, 2026

Copy link
Copy Markdown

Goal

Companion PR in compassion-switzerland (mini childpack note + paper tray selection): CompassionCH/compassion-switzerland#1812.

When a childpack was sent to the printer ("Print background" unchecked), it always came out in the language of the user's interface (typically English) instead of the language selected in the wizard the downloaded PDF was correct, only the printed one was wrong. Additionally, when a child has no photo yet, the childpack should say so in the selected language instead of leaving an empty frame.

Technical aspect

  • Language fix (child_compassion/models/ir_actions_report.py, new): QWeb unconditionally overwrites the lang rendering value with the environment language (ir.qweb._prepare_environment). The wizard's language travels correctly in the report data, but base_report_to_printer's print_document renders from the user's own environment, so the selected language was lost at rendering time. The new _render_qweb_html override aligns the environment language with data["lang"] for all childpack reports, they are recognised by their rendering model inheriting report.child_compassion.childpack_full, so the Swiss Mini childpack is covered too (its template has no t-lang at all).
  • Missing photo note (report/childpack.xml): the photo frame of the full and small childpacks now shows a translated note ("No photo registered for this child") when the child has no fullshot. Translations added to the fr_CH/de/it .po files.

Misc

…missing

- QWeb overwrites the `lang` rendering value with the environment language
  (ir.qweb._prepare_environment), so the language selected in the print
  wizard was lost when base_report_to_printer rendered the report from the
  user's own environment (send to printer path) and the childpack was
  printed in the interface language instead. Align the environment language
  with data["lang"] for all childpack reports (Full, Small and the Swiss
  Mini, whose rendering models share the same abstract report model).
- Show a translated note in the full childpack photo frame when the child
  has no registered photo (fr/de/it translations included).
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge: no blocking failure remains.

The report rendering behavior was exercised with a French report target and a German rendering user, confirming that the requested report language takes precedence. The checks also confirmed that missing or empty report data retains the environment language and that the full and small childpack layouts share the localized no-photo branch.

T-Rex T-Rex Logs

What T-Rex did

  • Executed an isolated harness that imports and runs the report-rendering override in a minimal Odoo-compatible environment model.
  • Reproduced the pre-change scenario where a French-target childpack rendered the missing-photo phrase in the German printer-user language.
  • Ran the changed rendering path and observed French output for data['lang'] = 'fr_CH', with omitted or empty data retaining it_IT and de_CH from their environments, and verified the childpack QWeb templates and the t-lang path.
  • Confirmed the diff has no whitespace errors, the override compiles, and the childpack XML is well formed.
  • Reviewed the uploaded artifacts for PR 2145, including the focused harness source, before/after behavior captures, and static validation logs, to confirm the validation steps and outcomes.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "[T3434] FIX: close the parenthesis in th..." | Re-trigger Greptile

Comment thread child_compassion/models/ir_actions_report.py Outdated
@ecino
ecino merged commit 512e738 into 18.0 Sep 3, 2026
2 checks passed
@ecino
ecino deleted the T3434-FixChildpack branch September 3, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants