Skip to content

T2705 donation history line breakdown - #406

Open
danpa32 wants to merge 3 commits into
18.0from
T2705-donation-history-line-breakdown
Open

danpa32 wants to merge 3 commits into
18.0from
T2705-donation-history-line-breakdown

Conversation

@danpa32

@danpa32 danpa32 commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

T2705 — Payments get mixed together in the MyCompassion donation history

Summary

Sponsors who paid several donations together saw them merged into one line in their donation history. Example from the ticket: 50.- for Maria's birthday and 50.- for the Christmas fund showed as "100.- for Maria's birthday", which confused the sponsor.

Root cause

The history (my_compassion.my2_donations_history_content, fed by _get_paid_invoices_subset in my_compassion/controllers/my2_donations.py) rendered one row per paid invoice:

  • the amount was always invoice.amount_total
  • the label depended on invoice.invoice_category, which picks a single category per invoice with the priority sponsorship > gift > fund (sponsorship_compassion/models/account_move.py, _compute_invoice_category)

So an invoice with a gift line and a fund line was labelled as the gift only, but with the combined total. A sponsorship invoice that also carried a gift showed only "(Sponsorship)".

Separate payments on the same day were never the problem (each one has its own invoice, so its own row). The problem is one invoice paying several donations:

  • a MyCompassion 2.0 gift package checkout (one sale order → one invoice), e.g. a Family Gift + a "food crisis" fund donation
  • one bank transfer covering a gift and a fund, where the invoice is created with several lines

Before / after (real invoices on stage18_neutralized)

Invoice Before After
3070588 Jonathan : Family Gift [ref], 50 Jonathan : Family Gift, 25 / Donation for : food crisis, 25
3174787 Patricia : Birthday Gift [ref], Family Gift [ref], 350 Patricia : Birthday Gift, 50 / Patricia : Family Gift, 50 / Donation for : Unsponsored Children Fund, 250
3162973 Nabdao, Hanna and Cristian (Sponsorship), 250 Nabdao, Hanna and Cristian (Sponsorship), 150 / Cristian : Family Gift, 100
3198542 Alondra, Whesly and Dasha (Sponsorship), 150 unchanged

How to test

  1. From the backend, log in as the portal user of the partner of invoice 3070588 or 3174787.
  2. Open /my2/donations and look at the donations history.
  3. Each donation of the invoice is on its own row with its own amount; the amounts add up to the invoice total.
  4. Switch the website language to DE / FR / IT: gift types, fund names, "(Sponsorship)", "and" and the child count are translated.

…istory

One invoice can pay several unrelated donations at once (a gift package
with a gift and a fund, one bank transfer for both). The history showed
one row per invoice with its full total under the label of only one of
them, so a birthday gift and a fund donation paid together looked like a
single larger birthday gift.

Each invoice is now split into its donations, each with its own amount.
The fund part of a sponsorship stays with its sponsorship. Gift rows show
the translated gift type instead of the gift name, which carried the
sponsor and child references.
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds donation history breakdown to show multiple donations per invoice.

No outstanding review finding blocks merging. The currency-precision concern remains in an existing resolved thread.

Findings

  1. P2 Preserve invoice currency precision ▶

Reviews (2) · Last reviewed commit: "[T2705] Address review: split gifts per ..."

Comment thread my_compassion/models/move.py Outdated
Comment thread my_compassion/templates/pages/my2_donations.xml Outdated
Comment thread my_compassion/templates/pages/my2_donations.xml
@greptile-apps

This comment has been minimized.

…r rows

- A gift given to several children is listed once per child, as each
  child got their own amount.
- Row amounts are rounded to the currency precision instead of being
  truncated to whole units, so the rows of an invoice add up to its total.
  Cents are only shown when there are some.
- Rows for products outside the sponsorship, gift and fund categories
  show the product name instead of an empty description.
Comment thread my_compassion/templates/pages/my2_donations.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant