Skip to content

[T2747] FIX: moved state update to after payment configuration#2086

Merged
ecino merged 2 commits into14.0from
T2747-onboarding-attachment
Mar 26, 2026
Merged

[T2747] FIX: moved state update to after payment configuration#2086
ecino merged 2 commits into14.0from
T2747-onboarding-attachment

Conversation

@ecino
Copy link
Copy Markdown
Member

@ecino ecino commented Mar 25, 2026

  • FIX: changing state triggers the creation of the communication job, but the payment information/pdf is not yet in the db at the time. This should solve that issue. Testing is still needed!

See also CompassionCH/compassion-switzerland#1747

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical timing issue where communication jobs were being triggered before essential payment configuration data was fully written to the database. By reordering the contract state update and introducing explicit database flush operations, the change ensures that all necessary payment information is persistently stored prior to activating the contract and initiating any dependent communication processes, thereby preventing potential data inconsistencies and ensuring reliable communication.

Highlights

  • State Update Timing: The contract state update to 'active' was relocated within the contract_active method to ensure it occurs after payment configuration is fully processed.
  • Database Flushing: Explicit flush() calls were added for res.partner and recurring.contract models to guarantee that payment-related data is persisted to the database before the contract state is marked as active, preventing race conditions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the contract_active method to ensure payment mode data is flushed to the database before activating the contract and triggering an auto-communication job. A review comment suggests refining the flush() calls to be more specific to the modified recordsets, rather than flushing the entire model, to prevent potential unintended side effects.

Danielgergely and others added 2 commits March 26, 2026 11:13
- FIX: changing state triggers the creation of the communication job, but the payment information/pdf is not yet in the db at the time. This should solve that issue.
Testing is still needed!
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ecino ecino force-pushed the T2747-onboarding-attachment branch from e88cbb1 to d24b7b6 Compare March 26, 2026 10:21
@ecino ecino merged commit 2344ae1 into 14.0 Mar 26, 2026
1 check passed
@ecino ecino deleted the T2747-onboarding-attachment branch March 26, 2026 10:22
ecino added a commit that referenced this pull request Apr 2, 2026
* [T2747] FIX: moved state update to after payment configuration

- FIX: changing state triggers the creation of the communication job, but the payment information/pdf is not yet in the db at the time. This should solve that issue.
Testing is still needed!

* Update sponsorship_compassion/models/contracts.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: Daniel Gergely <dgergely@compassion.ch>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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