Skip to content

[18.0][FIX] GMC incoming messages: intervention notifications, FCP notes, letters, per-message processing - #2214

Merged
Danielgergely merged 7 commits into
18.0from
fix-gmc-incoming-messages
Nov 17, 2026
Merged

Danielgergely merged 7 commits into
18.0from
fix-gmc-incoming-messages

Conversation

@davidwul

Copy link
Copy Markdown
Contributor

Fixes for incoming GMC messages found while going through the failed messages in production.

Changes

  • intervention_compassion
    • InterventionAmendmentCommitmentNotification: KeyError: 'intervention_id'. json_to_data was called on the payload still wrapped in the message name, so the mapping never found Intervention_ID. The id is now read from the unwrapped payload.
    • InterventionUpdateNotification: this schema is linked to UpdateInterventionDetailsRequest, but the handler only read InterventionDetailsRequest / InterventionAmendmentKitRequest, so these messages failed with "No related objects found.". The notification only carries a summary, so the full kit is now fetched with get_infos().
  • child_compassion: NotesKit with RecordType: ICP references the FCP id in GlobalID, not a child, and failed with "Associated object not found". These notes are now posted in the chatter of the project.
  • sbc_compassion: when no sponsorship matches a received letter, raise a clear error with the supporter and beneficiary global ids instead of KeyError: 'sponsorship_id'. In production this happened when the sponsorship belonged to a company the GMC user couldn't access (PL), and for letters addressed to a former correspondent.
  • sbc_translation: dispatch_s2b_letters skips S2B letters that already have a kit_identifier. A letter created from a CommunicationUpdates message failed with "Letter already sent to GMC cannot be translated!", and creating its commkit again would have sent it twice.
  • message_center_compassion: each incoming message is now processed in its own savepoint. Before, one failing message rolled back the whole job (up to 10 messages), and its traceback and the merged object_ids were written on every message of the batch.

Tests

  • Ran in an Odoo shell on a local copy of the Swiss database, rolled back after each run:
    • the FCP note is posted on project CO0702, and its HTML is escaped;
    • two note messages in the same job, one failing and one valid: only the failing one is in failure, with its own error, and the valid one succeeds.
  • The intervention, sponsorship-error and sbc_translation changes were linted (ruff, ruff-format, pylint-odoo) but not run.

🤖 Generated with Claude Code

… and InterventionUpdate notifications

- Amendment notification: read Intervention_ID from the unwrapped payload
  (json_to_data on the wrapped message never found it -> KeyError).
- InterventionUpdateNotification (linked to UpdateInterventionDetailsRequest)
  only carries a summary: fetch the full kit with get_infos() instead of
  failing with 'No related objects found.'

Assisted-by: claude-opus-5-5, medium, claude-code
Notes with RecordType ICP reference the FCP id in GlobalID, not a child:
they failed with 'Associated object not found'. Post them in the chatter
of the project instead.
…ved letter

Raise an explicit error (supporter and beneficiary global ids) instead of
KeyError 'sponsorship_id', e.g. when the sponsorship belongs to a company
the GMC user can't access or the letter is addressed to a former
correspondent.
A S2B letter created from a CommunicationUpdates message already has a
kit identifier: sending it to translation failed with 'Letter already
sent to GMC cannot be translated!' and creating its commkit again would
send it twice.
… own savepoint

Messages of a job were processed in one transaction: one failing message
rolled back the whole batch and its error (and the merged object ids)
were written on all messages. Each message now gets its own result.
@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

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

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming message batch] --> B[Next message]
    B --> C[Run handler inside a savepoint]
    C --> D{Handler raises an error?}
    D -->|Yes| E[Roll back this message's changes]
    E --> F[Save its failure details]
    D -->|No| G[Save its result and related IDs]
    F --> H{More messages?}
    G --> H
    H -->|Yes| B
    H -->|No| I[Finish batch]
    C -->|Retryable database conflict| J[Raise for job retry]
Loading

Reviews (3) · Last reviewed commit: "Merge branch '18.0' into fix-gmc-incomin..." · Reviewed by Greptile

Comment thread child_compassion/models/child_note.py Resolved
The message of an FCP note referenced the project id while its action
targets compassion.child.note: 'related objects' opened an unrelated
child note. FCP notes are now compassion.child.note records with a
project_id (child_id no longer required).

Assisted-by: claude-opus-5-5, medium, claude-code
@Danielgergely

Copy link
Copy Markdown
Member

👍

@Danielgergely
Danielgergely merged commit 26a588e into 18.0 Nov 17, 2026
2 checks passed
@Danielgergely
Danielgergely deleted the fix-gmc-incoming-messages branch November 17, 2026 12:22
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