Skip to content

[FIX] gift_compassion: keep partner and project on gifts without sponsorship - #2216

Merged
Danielgergely merged 2 commits into
18.0from
fix-project-gift-partner
Nov 17, 2026
Merged

Danielgergely merged 2 commits into
18.0from
fix-project-gift-partner

Conversation

@davidwul

Copy link
Copy Markdown
Contributor

Problem

Creating a sponsorship.gift manually for a project (Project Gift, e.g. ET0202), without sponsorship: after collecting the payments and setting the partner, saving dropped both the partner and the project.

partner_id, project_id and child_id lost store=True in the 18.0 migration (a2cc384) and became plain related fields on sponsorship_id. With no sponsorship, the values were written to an empty record and lost. The CreateGift message to GMC therefore had no Supporter_GlobalID nor RecipientId.

Fix

  • The three fields are now stored computed fields (readonly=False): taken from the sponsorship when there is one, editable otherwise.
  • create() / _search_for_similar_pending_gifts() no longer assume sponsorship_id is in the vals. Gifts without sponsorship are only blended with pending gifts of the same partner and project.
  • Post-migration 18.0.1.0.1 refills the columns of gifts whose values differ from their sponsorship (gifts created since 18.0 have NULLs).

Tests (local anonymized Swiss DB)

  • -u gift_compassion: migration ran. The 120 gifts that were out of sync now all match their sponsorship (each one checked against a snapshot taken before). The 35 gifts without sponsorship are unchanged.
  • Project Gift for ET0202 saved through the form view (rolled back): partner and project are stored, and the CreateGift JSON has RecipientType: Project Gift, RecipientId: ET0202 and the supporter's Supporter_GlobalID.
  • Not tested: actually sending the message to GMC.

🤖 Generated with Claude Code

…sorship

partner_id, project_id and child_id lost store=True in the 18.0 migration and
became plain related fields on sponsorship_id. On a manual Project Gift
(no sponsorship) the partner and project were silently dropped on save, and
the CreateGift message had no supporter nor RecipientId.

Make them stored computed fields filled from the sponsorship when there is
one and editable otherwise. Gifts without sponsorship are only blended with
pending gifts of the same partner and project. A post-migration refills the
columns of gifts created since 18.0 from their sponsorship.

Assisted-by: claude-opus-5-5, medium, claude-code
@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Reviews (2) · Last reviewed commit: "Merge branch '18.0' into fix-project-gif..." · Reviewed by Greptile

@Danielgergely

Copy link
Copy Markdown
Member

Also looks sound 👍

@Danielgergely
Danielgergely merged commit d225cd8 into 18.0 Nov 17, 2026
2 checks passed
@Danielgergely
Danielgergely deleted the fix-project-gift-partner branch November 17, 2026 12:15
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.

2 participants