-
Notifications
You must be signed in to change notification settings - Fork 51
[T2855] - Impact trip procedure : upload criminal records #2065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @SlWa99, 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 issue in the MyCompassion portal that prevented users from successfully uploading Criminal Records, particularly when event registrations were in an 'Attended' state. The changes enhance document upload security by using elevated privileges and standardize the handling of both Passport and Criminal Record documents. This leads to improved system stability, ensures event registrations remain visible, and streamlines the codebase for better maintainability. Highlights
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request aims to resolve an issue with uploading criminal records by standardizing document handling for both passports and criminal records. The changes in child_protection/models/partner_compassion.py add new fields for passport data, mirroring the existing structure for other documents, which is a good step for consistency. However, this approach also continues a pattern of code duplication in the compute methods for document names. My review provides a suggestion to refactor this duplicated logic to enhance long-term maintainability. Overall, the changes are logical and contribute to the stated goal of the pull request.
|
While I agree with the changes, I think you put the fields in the wrong module. Why not including those directly in the module which is using them ? Please move those fields in this module from your other pull request and we can close this one. |
|
Ok, it's normally done ! |
Criminal Record Save Failure Resolution
Purpose and Context
The goal of this PR is to fix a critical issue preventing users from updating their Criminal Record via the MyCompassion portal.
Due to Odoo security constraints and inconsistent document handling, uploads were failing when registrations were in the Attended state. In some cases, this also caused unstable registration statuses and the disappearance of events from the My Events section.
This PR should be reviewed together with a related PR, as both contribute to stabilizing the document upload and event registration workflows.
Applied Changes and Improvements
1. Portal Security and Save Reliability
Secure write with
sudoDocument saving in
event.registration.formnow usesform.registration_id.sudo().write(docs_to_save).Result
Documents are saved with sufficient privileges, preventing access errors, redirection crashes, and unintended status changes. The Attended status is preserved.
2. Document Management Standardization
Unified handling
Passport and Criminal Record are now managed in an identical and consistent way.
Technical debt removal
Complex
compute/inverselogic for Passport has been removed.Both documents are now standard
Binaryfields withattachment=Trueonres.partner.Single source of truth
Documents are physically attached to the partner (contact).
Event registrations access them through related fields.
XML cleanup
Backend views were simplified by removing obsolete technical fields (e.g.
passport_filename).3. Validation and Testing
Portal upload testing
Documents were uploaded using a real participant account for the Impact Trip in the Dominican Republic.
Technical verification
Uploaded documents are visible under
Settings → Technical → Attachmentsas Passport and Criminal Record.Data integrity
Each attachment correctly references the related partner in the Attached To field.
Outcome
Related PRs
This set of improvements is complemented by a related PR in the Compassion-website repository: