Repository navigation
[FIX] thankyou_letters: donation amount of lines booked from bank statements - #2198
Merged
Merged
Conversation
…tements Donations reconciled directly on a bank statement line (journal entry, no invoice) have no unit price, so price_subtotal is 0 and the amount is only in amount_currency (negative, credit side). The thank-you letter amount, the thank-you config selection (min donation amount) and the stored communication amount were all computed as 0 for these donations. Add get_donation_amount() on account.move.line: price_subtotal for invoice lines, -amount_currency for journal entry lines (a debit line on such an entry, i.e. a reversal, reduces the total). Assisted-by: claude-opus-5-5, medium, claude-code
Contributor
Author
|
@ecino thank you letter are generated wrongly when the donation is comming directly from the bankstatement, |
ecino
approved these changes
Nov 2, 2026
ecino
pushed a commit
to CompassionCH/compassion-switzerland
that referenced
this pull request
Nov 2, 2026
…ked from bank statements Use thankyou_letters get_donation_amount() instead of summing price_subtotal, which is 0 for donations reconciled directly on a bank statement line (journal entry without invoice). Depends on CompassionCH/compassion-modules#2198 Assisted-by: claude-opus-5-5, medium, claude-code
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.
Problem
Since donations are booked directly from the bank statement (journal entry, no invoice), their move lines have
price_unit = 0, soprice_subtotal = 0; the amount is only inamount_currency(negative, credit side). Everything summingprice_subtotalgot 0 for these donations:get_donations()→ thank-you letter showedCHF 0.-thankyou.config.for_donation()→ wrong config chosen (min donation amount never reached, e.g. no call for large gifts)partner.communication.job.amount(stored) → 0Fix
New
account.move.line.get_donation_amount():price_subtotalfor invoice lines,-amount_currencyfor journal entry lines (a debit line on such an entry, i.e. a reversal, reduces the total instead of being added asabs()would). Used in the three places above. Invoice lines are computed exactly as before.Tested on a copy of the Swiss DB: 3 statement donations of 20/100/40 →
CHF 160.-(wasCHF 0.-); invoice lines unchanged.Companion PR in compassion-switzerland (
partner_communication_switzerland.get_donationsoverride) depends on this one.Note: existing pending communications keep their stored
amountuntil their objects change.🤖 Generated with Claude Code