Skip to content

T3675 reconcile thankyou ambassador gift message - #2209

Open
danpa32 wants to merge 4 commits into
18.0from
T3675-reconcile-thankyou-ambassador-gift-message
Open

danpa32 wants to merge 4 commits into
18.0from
T3675-reconcile-thankyou-ambassador-gift-message

Conversation

@danpa32

@danpa32 danpa32 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

[T3675] Reconcile view: no thank-you letter, ambassador, gift message

This ticket is part of the ticket T3268 which include this one.

Related PR

CompassionCH/compassion-accounting#300

Problem

In the bank reconciliation view (Manual operation tab), a payment booked on a donation or gift product could not be kept from getting a thank-you letter, could not get an ambassador, and could not carry a message for the child's gift. The Contract field also found nothing when typing the sponsor number or the child code it displays.

While analysing it, a bug showed up: when a second gift arrives for the same sponsorship, gift type and year while the first one is still a draft, the gift job fails with KeyError: 'instructions' and the second gift is never created.

Changes

gift_compassion (18.0.1.0.1):

  • Merging a gift into a pending one no longer needs a message (other_gift_vals.get("instructions")): fixes the failed gift job.
  • New journal item field "Gift message" (gift_instructions), copied into the gift's instructions when the gift is created from a payment line. Merged gifts join the messages with "; ".
  • account.move.line.create decorated with api.model_create_multi.
  • Tests: tests/test_gift_from_payment.py (merge without message, message from the payment line, two payments merged). They use an existing active sponsorship of the database and skip themselves when there is none.

sponsorship_compassion:

  • Contracts can be searched by reference, sponsor number and child code (_rec_names_search). This applies to every Contract field.

account_reconcile_compassion_ce (18.0.1.0.1, now depends on crm_compassion):

  • "No thank-you letter" checkbox on the manual operation. It is the journal entry's existing avoid_thankyou_letter, saved before the lines are created, read-only once reconciled.
  • "Ambassador" on the manual line, copied to the journal item (user_id). Prefilled with the contract's ambassador when a contract is chosen or found from the gift QRR reference.
  • "Gift message" on the manual line, shown only for gift products, copied to the journal item and then to the gift.
  • Ambassador and gift message are restored when a line is reopened (e.g. after unreconcile).
  • The lines of the reconcile table show a hand cursor and a light hover: clicking a line opens it in the manual operation.
  • Labels translated in DE, FR and IT.

Not in this PR

  • Manual analytic distribution in the reconcile view: David's PR CompassionCH/account-analytic 7.0 add validation to cron #1, to test and merge separately.
  • When a payment is removed from a merged gift (unreconcile), the amount goes down but its message stays in the gift's instructions. Existing gift behaviour, unchanged.
  • A debit gift line without a pending gift still makes the gift job fail ("Expected singleton"). Written up as a separate issue.

Tests

  • Manual test in the reconcile view (Postfinance CHF): box ticked → no thank-you letter; box unticked → thank-you letter pending; contract found by sponsor number and child code.

After deployment

Upgrade gift_compassion and account_reconcile_compassion_ce (new field, view and style). The sponsorship_compassion change only needs the server restart.

Merging a second pending gift (same sponsorship, type and year) read
other_gift_vals["instructions"], which gift creation from a payment never
provides: the gift job failed with KeyError and the gift was never created.
Also decorate account.move.line.create with api.model_create_multi.
New journal item field gift_instructions ("Gift message"), copied into the
gift's instructions when the gift is created from a payment line.
Contract fields (e.g. in the reconcile view) only searched the contract
reference, while the contract name shows the sponsor ref and the child code:
typing what is displayed found nothing.
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