Skip to content

fix(spp_programs,spp_change_request_v2): reliably close wizard modals and hide Geographic Targeting#15

Merged
gonzalesedwin1123 merged 4 commits into19.0from
fix/spp-programs-wizard-modal-close
Feb 11, 2026
Merged

fix(spp_programs,spp_change_request_v2): reliably close wizard modals and hide Geographic Targeting#15
gonzalesedwin1123 merged 4 commits into19.0from
fix/spp-programs-wizard-modal-close

Conversation

@emjay0921
Copy link
Contributor

@emjay0921 emjay0921 commented Feb 6, 2026

Why is this change needed?

The wizard modals for both Programs and Change Requests intermittently stayed open after record creation. The old approach returned ir.actions.act_window directly from the wizard, which didn't reliably close the modal before navigating to the form view.

Additionally, the Geographic Targeting section in the Eligibility Manager was not functional and cluttered the UI.

How was the change implemented?

Program wizard modal fix

  • Created a JS client action (open_program_close_modal) that uses async/await to properly sequence: close the modal first, then navigate to the program form
  • Changed create_program() return type from ir.actions.act_window to ir.actions.client
  • Added ensure_one() and removed unnecessary for rec in self: loop
  • Enhanced client action to accept translated name and view_id from wizard params
  • Updated all callers (compliance wizard, CEL wizard) and tests to use action["params"]["program_id"] instead of action["res_id"]

Change Request wizard modal fix

  • Created a JS client action (open_cr_close_modal) with the same async/await pattern
  • Changed action_create_draft() return type from ir.actions.act_window to ir.actions.client
  • Passes res_model, res_id, view_id, and context through params for both detail form and fallback CR form

Geographic Targeting hidden

  • Added invisible="1" to Geographic Targeting group in eligibility manager view and create program wizard

New unit tests

No new tests — existing tests were updated to match the new return format.

Unit tests executed by the author

All 169 spp_programs tests pass (0 failed, 0 errors).

How to test manually

  1. Open Programs list → click "Create Program" → fill wizard → click Create → verify modal closes and program form opens
  2. Open Change Requests list → click "New Request" → select type and registrant → click Create → verify modal closes and CR detail form opens
  3. Open an Eligibility Manager form → verify Geographic Targeting section is not visible

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 resolves an intermittent user experience issue where the program creation wizard modal would sometimes fail to close after a program was successfully created. By introducing an asynchronous client-side action, the system now guarantees that the modal is dismissed before the user is redirected to the new program's details, providing a smoother and more predictable workflow.

Highlights

  • Reliable Modal Closure: The primary change introduces a new asynchronous JavaScript client action, openProgramCloseModal, to ensure that the wizard modal is reliably closed before navigating to the newly created program's form. This resolves an intermittent issue where the modal would remain open.
  • Refactored Program Creation Logic: The create_program method in create_program_wizard.py has been refactored to include self.ensure_one() and remove an unnecessary for-loop, simplifying the code and ensuring it operates on a single record.
  • Updated Action Return Type: The create_program method now returns an ir.actions.client action with a custom tag (open_program_close_modal) and the program_id embedded in its params, instead of the previous ir.actions.act_window.
  • Caller and Test Adaptations: All relevant callers, including compliance and CEL wizards, and associated test files, have been updated to correctly interpret the new action return format, specifically accessing program_id from action["params"]["program_id"].
Changelog
  • spp_programs/static/src/js/create_program.js
    • Added a new asynchronous JavaScript function openProgramCloseModal to handle the sequential closing of the modal and opening of the program form.
    • Registered openProgramCloseModal as a client action with the tag open_program_close_modal.
  • spp_programs/tests/test_create_program_wiz.py
    • Updated test assertions to reflect the new return type of create_program (from ir.actions.act_window to ir.actions.client).
    • Modified tests to access the program ID via action["params"]["program_id"] instead of action["res_id"].
  • spp_programs/tests/test_spp_cycle_compliance.py
    • Adjusted program ID retrieval from action["res_id"] to action["params"]["program_id"].
  • spp_programs/tests/test_spp_program_create_wizard_compliance.py
    • Updated program ID retrieval from action["res_id"] to action["params"]["program_id"].
  • spp_programs/wizard/create_program_wizard.py
    • Added self.ensure_one() to the create_program method.
    • Removed an unnecessary for rec in self: loop from create_program.
    • Changed the return value of create_program to an ir.actions.client dictionary, specifying open_program_close_modal as the tag and passing program_id in params.
  • spp_programs/wizard/create_program_wizard_cel.py
    • Modified program ID retrieval from action["res_id"] to action["params"]["program_id"].
  • spp_programs/wizard/create_program_wizard_compliance.py
    • Updated program ID retrieval from action["res_id"] to action["params"]["program_id"].
Activity
  • The pull request was authored by emjay0921.
  • The changes are a port of commit 7ef794b from openspp-modules-v2.
  • All 169 spp_programs tests passed, indicating no regressions were introduced.
  • The fix addresses an intermittent issue where the wizard modal would remain open after program creation.
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 effectively addresses an intermittent bug where the program creation wizard modal would not close reliably. The solution, which involves a new JavaScript client action using async/await to sequence the modal closing and navigation, is well-implemented. The related Python code has been refactored to use ensure_one() and return the new client action, which is a good improvement. All tests have been updated accordingly. I have a couple of suggestions to improve the new client action by making it more flexible and translatable, restoring some of the functionality from the previous implementation.

Comment on lines 15 to 34
const actionService = env.services.action;
const programId = action.params?.program_id;

// First close the modal
await actionService.doAction(
{type: "ir.actions.act_window_close"},
{clearBreadcrumbs: true}
);

// Then open the program form
if (programId) {
await actionService.doAction({
type: "ir.actions.act_window",
name: "Program",
res_model: "spp.program",
res_id: programId,
views: [[false, "form"]],
target: "current",
});
}

Choose a reason for hiding this comment

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

medium

The name of the action window is hardcoded as "Program", which isn't translatable. Also, the views parameter is hardcoded to use the default form view ([[false, "form"]]), which differs from the previous implementation that allowed a specific view_id to be used. To improve internationalization and restore the original flexibility, consider passing the name and view_id from the server-side action's parameters.

    const actionService = env.services.action;
    const programId = action.params?.program_id;
    const programName = action.params?.name || "Program";
    const viewId = action.params?.view_id || false;

    // First close the modal
    await actionService.doAction(
        {type: "ir.actions.act_window_close"},
        {clearBreadcrumbs: true}
    );

    // Then open the program form
    if (programId) {
        await actionService.doAction({
            type: "ir.actions.act_window",
            name: programName,
            res_model: "spp.program",
            res_id: programId,
            views: [[viewId, "form"]],
            target: "current",
        });
    }

Comment on lines 430 to 432
"params": {
"program_id": program_id,
},

Choose a reason for hiding this comment

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

medium

To support internationalization and allow for specific form views, it's a good practice to pass the translated window name and the calculated view_id to the client action. The JavaScript action can then use these parameters instead of hardcoded values.

            "params": {
                "program_id": program_id,
                "name": _("Program"),
                "view_id": view_id.id,
            },

@emjay0921 emjay0921 force-pushed the fix/spp-programs-wizard-modal-close branch from dd8d38d to 2fda0a7 Compare February 11, 2026 03:08
@emjay0921 emjay0921 force-pushed the fix/spp-programs-wizard-modal-close branch from 2fda0a7 to 54337dd Compare February 11, 2026 03:10
…tion

Use ir.actions.client with async/await pattern to close the wizard modal
before navigating to the CR detail form. Same approach as spp_programs
wizard — prevents the modal from staying open on slow connections.
@emjay0921 emjay0921 changed the title fix(spp_programs): reliably close wizard modal after program creation fix(spp_programs,spp_change_request_v2): reliably close wizard modals and hide Geographic Targeting Feb 11, 2026
@gonzalesedwin1123 gonzalesedwin1123 merged commit 619f6a8 into 19.0 Feb 11, 2026
24 of 28 checks passed
@gonzalesedwin1123 gonzalesedwin1123 deleted the fix/spp-programs-wizard-modal-close branch February 11, 2026 03:26
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