Skip to content

Conversation

@ecino
Copy link
Member

@ecino ecino commented Jan 19, 2026

No description provided.

davidwul and others added 12 commits January 19, 2026 12:12
* T2617 ADD analytic accounts on interventions

- The abilty to link intervention category to funds.

* Update intervention_compassion/models/compassion_intervention.py

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

---------

Co-authored-by: ecino <ecino@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Restirct notif. to only hold of type SUB_CHILD_HOLD

* Run precommit

* Correct wrong type of Hold

* Fix typo

---------

Co-authored-by: Shayan Mouktar <119674649+Shayan105@users.noreply.github.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ecino, 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 integrates several forward-ported changes from version 14.0, focusing on enhancing financial management through analytic accounting for interventions, streamlining the gift generation workflow for contracts, and improving the robustness of communication and correspondence processes. These updates aim to provide more granular control over financial data, increase operational efficiency, and ensure more accurate system behavior in various scenarios.

Highlights

  • Analytic Accounting for Interventions: Introduced new analytic groups and accounts for interventions, allowing for more detailed financial tracking. Intervention categories can now be linked to specific analytic groups, and a new feature allows users to create or link analytic accounts directly from intervention records.
  • Refined Gift Generation Process: The gift generation wizard has been significantly refactored to handle multiple contracts simultaneously, improving efficiency for bulk operations. It also includes a new option to bypass invoice suspension for specific gift generations.
  • Improved Communication Job Handling: Enhanced the parsing of object IDs in communication jobs to handle various string formats, and introduced a more specific channel for asynchronous printing tasks, which can improve job queue management.
  • Correspondence and Hold Logic Enhancements: Updated the logic for reactivating and resubmitting letters, ensuring immediate processing of messages. The 'no money hold' notification system was also refined to ensure messages are posted only for the correct hold types.
  • Christmas Period Calculation Improvement: The method for determining if a date falls within the Christmas period has been improved to correctly handle periods that span across the end of the year.

🧠 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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
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 is a forward-port of changes from version 14.0, introducing a variety of bug fixes, refactorings, and new features, notably the addition of analytic accounts for interventions. My review identifies a critical syntax issue and a potential robustness problem, offering suggestions to improve code quality and prevent runtime errors.

Comment on lines +33 to 62
for contract_id in self.contract_ids.filtered("no_birthday_invoice"):
gift_obj = self.env["sponsorship.gift"]
birthday_gift_type = self.env.ref(
"sponsorship_compassion.gift_type_birthday"
)
gift_vals = {"sponsorship_gift_type_id": birthday_gift_type.id}
gift_date = self.compute_date_birthday_invoice(
self.contract_id.child_id.birthdate
contract_id.child_id.birthdate
)
# Search that a gift is not already pending
existing_gifts = gift_obj.search(
[
("sponsorship_id", "=", self.contract_id.id),
("sponsorship_id", "=", contract_id.id),
("gift_date", ">=", gift_date.replace(day=1, month=1)),
("gift_date", "<=", gift_date.replace(day=31, month=12)),
("gift_type_id", "=", birthday_gift_type.id),
]
)
if not existing_gifts:
# Create a gift record
gift_vals["sponsorship_id"] = self.contract_id.id
gift_vals["sponsorship_id"] = contract_id.id
gift_vals["date_partner_paid"] = gift_date
gift_vals["gift_date"] = gift_date
gift_vals["amount"] = self.contract_id.birthday_invoice
gift_vals["amount"] = contract_id.birthday_invoice
gift_obj.create(gift_vals)
else:
super().generate_invoice(due_date)
self.contract_ids -= contract_id
super().generate_invoice(due_date)

def compute_date_birthday_invoice(self, child_birthdate, payment_date=None):
"""Set date of invoice two months before child's birthdate"""
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This method has a few issues:

  1. Syntax Error: There are indentation errors that will cause a SyntaxError at runtime. For example, gift_vals = ... is not correctly indented within the if block.
  2. Risky Iteration: Modifying a recordset (self.contract_ids) while iterating over it is not a safe pattern and can lead to unpredictable behavior, such as skipping records.

I suggest refactoring the method to fix the indentation and to handle the contract filtering in a safer and more readable way by first separating the contracts into two groups.

    contracts_to_handle_here = self.contract_ids.filtered('no_birthday_invoice')
    contracts_for_super = self.contract_ids - contracts_to_handle_here

    for contract_id in contracts_to_handle_here:
        gift_obj = self.env["sponsorship.gift"]
        birthday_gift_type = self.env.ref(
            "sponsorship_compassion.gift_type_birthday"
        )
        gift_vals = {"sponsorship_gift_type_id": birthday_gift_type.id}
        gift_date = self.compute_date_birthday_invoice(
            contract_id.child_id.birthdate
        )
        # Search that a gift is not already pending
        existing_gifts = gift_obj.search(
            [
                ("sponsorship_id", "=", contract_id.id),
                ("gift_date", ">=", gift_date.replace(day=1, month=1)),
                ("gift_date", "<=", gift_date.replace(day=31, month=12)),
                ("gift_type_id", "=", birthday_gift_type.id),
            ]
        )
        if not existing_gifts:
            # Create a gift record
            gift_vals["sponsorship_id"] = contract_id.id
            gift_vals["date_partner_paid"] = gift_date
            gift_vals["gift_date"] = gift_date
            gift_vals["amount"] = contract_id.birthday_invoice
            gift_obj.create(gift_vals)

    self.contract_ids = contracts_for_super
    super().generate_invoice(due_date)

Comment on lines +747 to +748
unlist_string = id_strings.strip("[]")
object_ids += list(map(int, unlist_string.split(",")))
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation for parsing id_strings is a bit fragile. It could fail if the string is empty or contains unexpected whitespace after stripping brackets. Using a regular expression to find all digit sequences would be more robust and handle various formats like "[1, 2, 3]", "1,2,3", or even malformed strings more gracefully.

Suggested change
unlist_string = id_strings.strip("[]")
object_ids += list(map(int, unlist_string.split(",")))
object_ids += [int(i) for i in re.findall(r'\d+', id_strings)]

@ecino ecino force-pushed the 17.0-forward-port branch from f680ac5 to 5e09dfa Compare January 19, 2026 13:05
@ecino ecino force-pushed the 17.0-forward-port branch from 5e09dfa to e1812f8 Compare January 19, 2026 13:07
@ecino ecino merged commit 1c9b3ae into 17.0 Jan 19, 2026
1 check passed
@ecino ecino deleted the 17.0-forward-port branch January 19, 2026 13:29
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.

3 participants