-
Notifications
You must be signed in to change notification settings - Fork 0
fix(spp_programs): open program form modal when clicking membership row #22
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
base: 19.0
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @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
Changelog
Activity
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
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.
| if (programField && programField.id) { | ||
| programId = programField.id; | ||
| } else { | ||
| return super.onCellClicked(record, column, ev); | ||
| } |
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.
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.
| 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); | |
| } |
| var action = await this.orm.call("spp.program", "open_program_form", [ | ||
| programId, | ||
| ]); |
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.
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.
| var action = await this.orm.call("spp.program", "open_program_form", [ | |
| programId, | |
| ]); | |
| const action = await this.orm.call("spp.program", "open_program_form", [ | |
| programId, | |
| ]); |
Why is this change needed?
Clicking a program membership row in the registrant form (res.partner) was opening the
spp.program.membershipform 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.onCellClickedpatch incustom_open_list.jsto also handlespp.program.membershiprows:program_idfrom the membership record dataopen_program_formwith the program IDtarget: "new") to keep the registrant contextNew unit tests
Unit tests executed by the author
How to test manually
Related links