T3491 together donation fixes - #407
Conversation
The website redirect of /shop/confirmation to /together/donation/confirmation never applied: website redirects are only used for URLs that match no route. Donors landed on the shop confirmation page. Redirect the confirmed orders containing a project donation, as done for the event donations.
The "Donation successful" and "Donation received" templates only live in the database. The v14 -> v18 conversion left a Jinja filter that made the donation receipt fail, German, French and Italian texts never converted, and wrong subjects. Rewrite them in QWeb in the four languages, keeping their wording. The participant notice shows only the amount given to its own project, and the donor receipt names every project of the donation.
The donor already receives the thank-you letter of the product: the receipt stays for review even if its rule is reactivated with automatic sending.
|
| <t t-set="number_fcps" t-value="object.get_snippet('number_fcps', strip_html=True)"/> | ||
| <t t-set="number_children" t-value="object.get_snippet('number_children', strip_html=True)"/> |
There was a problem hiding this comment.
If the pending donor receipt is enabled for a German-speaking donor, these expressions pass strip_html=True, but the shared get_snippet method accepts only a snippet name. Rendering raises TypeError, so the receipt cannot be produced. Remove the unsupported argument or use a supported way to strip the returned text.
Artifacts
Source of the snippet contract check
- The authored script extracts the German template expressions and executes the shared method body with a stubbed lookup, showing exactly how the contract was tested.
Contract-compatible snippet calls
- The executed control omits the unsupported keyword and returns snippet text for both names, establishing the working comparison.
PR snippet calls with strip_html
- The executed PR expressions each raise an unexpected-keyword TypeError, supporting finding 1.
There was a problem hiding this comment.
False positive: this links to the default branch (14.0), where get_snippet(self, snippet_name) has no strip_html. This PR targets 18.0, where the signature is get_snippet(self, snippet_name, strip_html=False) (partner_communication/models/communication_job.py). The German receipt was rendered with these snippets during testing, and other migrated v18 templates use the same call. No change needed.
There was a problem hiding this comment.
You’re right — this was a false positive caused by checking the default (14.0) branch. In v18, get_snippet accepts strip_html=False, so the German template calls are valid. No change is needed.
The donation receipt is built from invoices and the participant notice from invoice lines, as in the existing databases, but the module data declared the two models swapped. The data is not updated on existing databases: this only aligns new installations with them.
T3491 — Fix failing quality test: TOGETHER donation
Related PR and ticket
CompassionCH/compassion-modules#2166
Linked to T3464 (same quality test, merged).
Failing steps
/shop/confirmationinstead of/together/donation/confirmation.Root causes
Step 6.
crowdfunding_compassion/data/website_redirect.xmlredirects/shop/confirmationwith a 301website.rewrite. In core (v14 and v18), 301/302 rewrites are only served byir.http._serve_fallback(), i.e. for URLs matching no route./shop/confirmationis a real route, so the rewrite never applies.website_event_compassionandmy_compassionalready override the route for their own orders.Step 11. "Crowdfunding - Donation successful" is archived in the configuration (send mode "none", since 2025-12-01, same in v14), so the product thank-you letter is the expected communication with the current configuration. Independently,
generate_crowdfunding_receiptfails when the rule is active: the templates "Donation successful" and "Donation received" only live in the database (the XML holds a placeholder,noupdate), and the v14 → v18 conversion leftt-out="invoice.amount_total | int"(Jinja filter →TypeError), German/French/Italian bodies never converted (raw% set/${...}, in some even translated Jinja keywords), and wrong subjects.Step 13. The notice (
event.ambassador_config_id) is only created for invoice lines with anevent_id.crm_compassion.account_move_line._compute_event()only read the root plan column (account_id) and thecrm_compassion.plan_eventscolumn; the analytic accounts of TOGETHER and other migrated events are in the DB-only "Legacy" plan, soevent_idstayed empty. (Separately, the participant of the project used in the test opted out of donation notices,ambassador_receipt_send_mode = none, as in v14.)Changes
compassion-website:9adf4b8— Show the TOGETHER thank-you page after a project donation:/shop/confirmationoverride redirecting confirmed orders with aparticipant_idline to/together/donation/confirmation; other orders go tosuper()(event donations, MyCompassion, standard shop).45ce8af— Repair the TOGETHER donation email templates: post-migration rewriting body and subject of both templates in QWeb for en/de/fr/it, keeping their wording. The participant notice sums only its own lines (a cart can hold donations to several projects); the donor receipt names every project of the invoice.50e7df9— Keep the TOGETHER donation receipt pending: created withauto_send=False, the donor already receives the product thank-you letter.How to test
Test in the new Odoo (v18), with a copy of the data (locally
stage18_neutralized, or stagingcrowdfunding.compassion.ch). The fixes are on two branches:T3491-together-donation-fixes(compassion-website) andT3491-event-any-analytic-plan(compassion-modules). Modulecrowdfunding_compassionmust be upgraded (-u crowdfunding_compassion) so that the corrected email texts are installed.Choose a project whose participant receives donation notices, for example the project linked to the event "Courir pour donner accès à l'eau potable" ("Toilets for all"). The participant of "Vocational Training Burkina Faso" chose not to receive notices, so step 13 can't be tested with that project.
Step 6 – Page after the payment
Locally, only the PostFinance payment method is enabled, so the payment itself is easier to test on staging (test payment), or locally after enabling a test payment provider.
Step 13 – Notice to the participant
Two projects in the same cart: donate to two TOGETHER projects in one checkout (e.g. 25 CHF and 30 CHF). Expected: each participant's notice shows only the amount given to their own project (not the total of the order).
The communications are created by background jobs a few seconds after the payment: if nothing appears, check Job Queue > Queue > Jobs (the job runner must be running).
Step 11 – Thank-you letter of the donor