Skip to content

fix(spp_programs): open program form modal when clicking membership row#22

Merged
gonzalesedwin1123 merged 2 commits into19.0from
fix/program-membership-click-opens-program
Feb 19, 2026
Merged

fix(spp_programs): open program form modal when clicking membership row#22
gonzalesedwin1123 merged 2 commits into19.0from
fix/program-membership-click-opens-program

Conversation

@emjay0921
Copy link
Contributor

Why is this change needed?

Clicking a program membership row in the registrant form (res.partner) was opening the spp.program.membership form instead of the program form. Users expect to see the program details when clicking a membership entry.

How was the change implemented?

Extended the ListRenderer.onCellClicked patch in custom_open_list.js to also handle spp.program.membership rows:

  • Extracts program_id from the membership record data
  • Calls open_program_form with the program ID
  • Opens the program form in a modal (target: "new") to keep the registrant context

New unit tests

Unit tests executed by the author

How to test manually

  1. Open a registrant (individual or group) form
  2. Scroll to the "Program Enrollments" section
  3. Click on a program membership row
  4. Verify the program form opens in a modal dialog (not navigating away)

Related links

@gemini-code-assist
Copy link

Summary of Changes

Hello @emjay0921, 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 enhances the user experience within the registrant form by ensuring that clicking on a program membership entry consistently opens the relevant program details in a new modal window. This resolves an issue where the incorrect form was displayed, streamlining the workflow for users needing to view program information directly from a registrant's enrollment list.

Highlights

  • Corrected Program Form Opening: Clicking a program membership row in the registrant form now correctly opens the associated program details form instead of the membership form.
  • Modal Display for Program Forms: The program form, when opened from a membership row, now appears in a modal dialog, preserving the registrant context and preventing navigation away from the current view.
  • Extended List Renderer Patch: The onCellClicked method in custom_open_list.js was extended to specifically handle spp.program.membership records, extracting the correct program_id.
Changelog
  • spp_programs/static/src/js/custom_open_list.js
    • Extended the onCellClicked method to recognize spp.program.membership records.
    • Implemented logic to extract the program_id from spp.program.membership data.
    • Configured the program form to open in a new modal (action.target = "new") when triggered from a membership row.
Activity
  • New unit tests were added by the author.
  • Unit tests were executed by the author.
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

@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 correctly identifies the need to change the click behavior on program membership rows for a better user experience. The approach of patching ListRenderer.onCellClicked is appropriate. However, the implementation contains a critical bug in how it retrieves the program_id from the membership record, which prevents the feature from working as intended. I've provided a fix for this. Additionally, there's a minor suggestion to improve code style consistency. Once these points are addressed, the change should work as expected.

Comment on lines +36 to +40
if (programField && programField.id) {
programId = programField.id;
} else {
return super.onCellClicked(record, column, ev);
}

Choose a reason for hiding this comment

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

critical

The logic to retrieve the program ID from a spp.program.membership record is incorrect. In Odoo's OWL framework, a Many2one field like program_id is represented in record.data as an array [id, displayName], not an object with an id property. The current check programField.id will always be falsy, causing the function to fall back to the default behavior and not open the program form as intended.

Suggested change
if (programField && programField.id) {
programId = programField.id;
} else {
return super.onCellClicked(record, column, ev);
}
if (programField && programField.length) {
programId = programField[0];
} else {
return super.onCellClicked(record, column, ev);
}

Comment on lines 44 to 46
var action = await this.orm.call("spp.program", "open_program_form", [
programId,
]);

Choose a reason for hiding this comment

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

medium

For consistency with modern JavaScript practices and the surrounding code, it's better to use const or let instead of var. Since the action variable is not reassigned, const is the most appropriate choice here.

Suggested change
var action = await this.orm.call("spp.program", "open_program_form", [
programId,
]);
const action = await this.orm.call("spp.program", "open_program_form", [
programId,
]);

@gonzalesedwin1123 gonzalesedwin1123 merged commit 0cbb46f into 19.0 Feb 19, 2026
25 of 26 checks passed
@gonzalesedwin1123 gonzalesedwin1123 deleted the fix/program-membership-click-opens-program branch February 19, 2026 06:36
@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.61%. Comparing base (071686c) to head (4d76d36).
⚠️ Report is 7 commits behind head on 19.0.

❗ There is a different number of reports uploaded between BASE (071686c) and HEAD (4d76d36). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (071686c) HEAD (4d76d36)
spp_cr_types_base 1 0
spp_cr_types_advanced 1 0
spp_starter_social_registry 1 0
spp_starter_sp_mis 1 0
spp_mis_demo_v2 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             19.0      #22      +/-   ##
==========================================
- Coverage   76.43%   69.61%   -6.82%     
==========================================
  Files          33      359     +326     
  Lines        3093    27980   +24887     
==========================================
+ Hits         2364    19479   +17115     
- Misses        729     8501    +7772     
Flag Coverage Δ
spp_api_v2 89.14% <ø> (?)
spp_api_v2_change_request 66.61% <ø> (?)
spp_api_v2_cycles 65.45% <ø> (?)
spp_api_v2_data 48.67% <ø> (?)
spp_api_v2_entitlements 68.43% <ø> (?)
spp_api_v2_products 64.39% <ø> (?)
spp_api_v2_service_points 63.12% <ø> (?)
spp_api_v2_vocabulary 43.70% <ø> (?)
spp_audit 69.47% <ø> (?)
spp_base_common 92.81% <ø> (?)
spp_cel_event 81.23% <ø> (?)
spp_claim_169 63.78% <ø> (?)
spp_cr_types_advanced ?
spp_cr_types_base ?
spp_dci_client_dr 75.33% <ø> (?)
spp_mis_demo_v2 ?
spp_programs 49.56% <ø> (?)
spp_security 51.08% <ø> (?)
spp_starter_social_registry ?
spp_starter_sp_mis ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Comments