Skip to content

fix(spp_studio_events): clarify Create Event step 1 for Studio types (#992)#191

Open
emjay0921 wants to merge 6 commits into19.0from
fix/992-studio-event-data-button
Open

fix(spp_studio_events): clarify Create Event step 1 for Studio types (#992)#191
emjay0921 wants to merge 6 commits into19.0from
fix/992-studio-event-data-button

Conversation

@emjay0921
Copy link
Copy Markdown
Contributor

Why is this change needed?

The Event Data button on the registrant form opens the basic spp.create.event.wizard. Step 1 of that wizard exposes a raw JSON event_data input and a Create Event button — both of which are misleading when the selected event type is Studio-backed:

  • The structured fields defined in Studio render in stage 2 (the Studio wizard spp.event.data.entry.wizard that create_event() forwards to), not stage 1.
  • Testers reading step 1 think the JSON field is where they're meant to enter values, and that Create Event writes the record. Neither is true for Studio types.

QA Round 1 attempted to fix this by overriding res.partner.open_create_event_wizard to bypass the basic wizard entirely for Studio types — but that bypass also removed the event-type picker, breaking the single, consistent entry point for both Studio and non-Studio types. That override is reverted in this PR.

How was the change implemented?

Step 1 of the basic wizard now adapts to the selected event type:

  • A new computed boolean is_studio_event_type on spp.create.event.wizard returns true when the picked event type has an active spp.studio.event.type.
  • A view extension (wizard/create_event_wizard_views.xml) inheriting spp_event_data.view_spp_create_event_wizard_form:
    • Hides the raw JSON event_data group when is_studio_event_type.
    • Inserts a full-width info banner above the form: "This event type uses structured fields. Click Next to enter them — you'll be moved to the second stage where each defined field appears as its own input."
    • Hides the original Create Event button and adds a Next button (same create_event backing method, so the existing redirect-to-Studio-wizard logic still fires).
  • Non-Studio event types keep the original UX (JSON input + Create Event button) — for these types step 1 is the only stage.

Bumps spp_studio_events 19.0.2.0.1 → 19.0.2.0.2.

New unit tests

None — the change is XML view inheritance + a one-line computed field. Behaviour was validated manually on a ./spp start --wipe instance against the full QA matrix below (Studio individual, Studio group, non-Studio fallback, empty state).

Unit tests executed by the author

  • Existing spp_studio_events test suite (no new tests added; existing coverage on _get_active_studio_event_type is unchanged).

How to test manually

See the Round 2 QA test guide on OP#992 for the full matrix. Summary:

  1. ./spp start --wipe → install spp_studio_events.
  2. Create + activate at least one Studio event type with Target Type = Individual.
  3. Registry → Browse All Individuals → open any individual → click Event Data → pick the Studio event type from the dropdown.
    • Expected: no JSON input visible; blue info banner present; single Next button in footer; clicking Next opens the Studio wizard with each defined field as its own input.
  4. From the same wizard, pick a non-Studio event type instead.
    • Expected: original UX — JSON input visible, Create Event button visible, no banner, no Next button.
  5. Open the wizard but pick nothing.
    • Expected: only the event-type dropdown — no JSON input, no banner, no Next button, no Create Event button.

Related links

emjay0921 added 4 commits May 7, 2026 16:52
… applicable

When clicking the **Event Data** button on a registrant form
(individual or group), the wizard that opened was the basic
`spp.create.event.wizard` — which only exposes a raw JSON input field.
Studio-defined event types and their structured field configurations
(label, type, required flag, group, etc.) were ignored on this entry
path, leaving Studio event types effectively unusable from the
Individuals view.

Override `res.partner.open_create_event_wizard` in `spp_studio_events`:

- If any active Studio event type matches the registrant's target_type
  (`individual`, `group`, or `both`), open
  `spp.event.data.entry.wizard` with `default_partner_id` set. The
  Studio wizard renders each defined field as its own form input.
- Otherwise, fall back to `super()` so the legacy basic wizard still
  serves non-Studio (manual / dedicated-model) event types — no
  regression for deployments that haven't adopted Studio.

The redirect logic that already lived in `create_event_wizard.create_event()`
still works as a safety net for any other entry point that lands on
the basic wizard with a Studio-backed event_type_id selected.

Bumps spp_studio_events 19.0.2.0.0 → 19.0.2.0.1.

Refs OP#992.
Clicking the **Events** smart button on a Studio Event Type form
crashed with `UncaughtPromiseError: View types not defined tree found
in act_window action`. The action returned `view_mode="tree,form"`,
but Odoo 19 renamed `tree` to `list` — the client-side action handler
can no longer resolve the view.

One-line swap to `view_mode="list,form"` per OP#993's suggested fix.
The `<list>` tag inside view arch XML is unaffected; only `view_mode`
on `ir.actions.act_window` payloads needs the new name.

Refs OP#993.
…ard when applicable"

This reverts commit 148db5aa3140862ddb98ff6a09a45ed94e8aa00d.

The override of `res.partner.open_create_event_wizard` introduced
problems beyond the original OP#992 scope (flagged on the ticket).
Reverting to the pre-#992 behaviour so we can re-evaluate the right
fix from the initial buggy state — the basic wizard's raw-JSON entry
on Studio event types is still the original bug to address, just not
via this routing override.

Kept on this branch:
- The OP#993 fix (action_view_events `view_mode="tree,form"` →
  `"list,form"`), which is unrelated to the Event Data button routing.
- The version bump to 19.0.2.0.1 (still warranted by #993).
- The HISTORY entry, with only the #993 bullet under 19.0.2.0.1.

Removed:
- `spp_studio_events/models/res_partner.py`
- The `from . import res_partner` line in `models/__init__.py`
- The OP#992 HISTORY bullet.

Refs OP#992.
Copy link
Copy Markdown

@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 enhances the 'Create Event' wizard for Studio-backed event types by introducing a multi-step UI that hides raw JSON fields and adds helpful guidance. It also fixes a crash when viewing events by updating the view mode to 'list' for Odoo 19 compatibility. Feedback from the review indicates that the documentation files, specifically the README and its generated HTML description, have corrupted table formatting where reduced column widths have broken code literals and syntax.

Comment thread spp_studio_events/README.rst Outdated
Comment on lines +53 to +76
+----------------------------------+----------------------------------+
| Model | Description |
+==================================+==================================+
| ``spp.studio.event.type`` | Custom event type definition |
| | with draft/active lifecycle |
+----------------------------------+----------------------------------+
| ``spp.studio.event.field`` | Field definition with type, |
| | validation, and visibility |
+----------------------------------+----------------------------------+
| ``spp.studio.event.field.group`` | Groups fields into tabs in the |
| | data entry wizard |
+----------------------------------+----------------------------------+
| ``s | Reusable template containing |
| pp.studio.event.field.template`` | field definitions |
+----------------------------------+----------------------------------+
| ``spp.st | Field definition within a |
| udio.event.field.template.line`` | template |
+----------------------------------+----------------------------------+
| ``spp.studio.event.type.wizard`` | 3-step wizard for creating event |
| | types |
+----------------------------------+----------------------------------+
| ``spp.event.data.entry.wizard`` | Generated wizard for entering |
| | event data |
+----------------------------------+----------------------------------+
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The 'Key Models' table formatting is corrupted. The reduction in column width has caused long model names to wrap incorrectly, splitting the double-backtick literals (e.g., lines 65-66 and 68-69). This is invalid reStructuredText and will not render correctly. Please restore the column widths to accommodate the full model names without wrapping inside the literals.

+------------------------------------------+----------------------------------+
| Model                                    | Description                      |
+==========================================+==================================+
| spp.studio.event.type                    | Custom event type definition     |
|                                          | with draft/active lifecycle      |
+------------------------------------------+----------------------------------+
| spp.studio.event.field                   | Field definition with type,      |
|                                          | validation, and visibility       |
+------------------------------------------+----------------------------------+
| spp.studio.event.field.group             | Groups fields into tabs in the   |
|                                          | data entry wizard                |
+------------------------------------------+----------------------------------+
| spp.studio.event.field.template          | Reusable template containing     |
|                                          | field definitions                |
+------------------------------------------+----------------------------------+
| spp.studio.event.field.template.line     | Field definition within a        |
|                                          | template                         |
+------------------------------------------+----------------------------------+
| spp.studio.event.type.wizard             | 3-step wizard for creating event |
|                                          | types                            |
+------------------------------------------+----------------------------------+
| spp.event.data.entry.wizard              | Generated wizard for entering    |
|                                          | event data                       |
+------------------------------------------+----------------------------------+
References
  1. Manual changes to files generated by oca-gen-addon-readme will be overwritten. Ensure the source formatting is correct.

Comment thread spp_studio_events/README.rst Outdated
Comment on lines +102 to +115
+----------------------------------+----------------------------------+
| Group | Access |
+==================================+==================================+
| `` | Read event types and templates |
| spp_studio.group_studio_viewer`` | |
+----------------------------------+----------------------------------+
| ``spp_stud | Read/Write/Create on event |
| io.group_studio_editor_officer`` | types, fields, and templates (no |
| | delete on event |
| | types/fields/templates) |
+----------------------------------+----------------------------------+
| ``s | Full CRUD |
| pp_studio.group_studio_manager`` | |
+----------------------------------+----------------------------------+
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The 'Security' table formatting is also corrupted. Similar to the 'Key Models' table, the column width reduction has caused literals to be split across lines (e.g., lines 105-106, 108-109, 113-114), which breaks the RST syntax. Please fix the table layout.

Suggested change
+----------------------------------+----------------------------------+
| Group | Access |
+==================================+==================================+
| `` | Read event types and templates |
| spp_studio.group_studio_viewer`` | |
+----------------------------------+----------------------------------+
| ``spp_stud | Read/Write/Create on event |
| io.group_studio_editor_officer`` | types, fields, and templates (no |
| | delete on event |
| | types/fields/templates) |
+----------------------------------+----------------------------------+
| ``s | Full CRUD |
| pp_studio.group_studio_manager`` | |
+----------------------------------+----------------------------------+
+--------------------------------------------+----------------------------------+
| Group | Access |
+============================================+==================================+
| spp_studio.group_studio_viewer | Read event types and templates |
+--------------------------------------------+----------------------------------+
| spp_studio.group_studio_editor_officer | Read/Write/Create on event |
| | types, fields, and templates (no |
| | delete on event |
| | types/fields/templates) |
+--------------------------------------------+----------------------------------+
| spp_studio.group_studio_manager | Full CRUD |
+--------------------------------------------+----------------------------------+
References
  1. Manual changes to files generated by oca-gen-addon-readme will be overwritten. Ensure the source formatting is correct.

Comment on lines 423 to 432
<tr><td><tt class="docutils literal">s
pp.studio.event.field.template</tt></td>
<td>Reusable template containing
field definitions</td>
</tr>
<tr><td><tt class="docutils literal">spp.studio.event.field.template.line</tt></td>
<tr><td><tt class="docutils literal">spp.st
udio.event.field.template.line</tt></td>
<td>Field definition within a
template</td>
</tr>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The HTML table for 'Key Models' is corrupted. The model names are split across lines and the tags have been replaced with raw backticks (``), which are not valid HTML for code literals. This suggests a broken documentation generation process or an incorrect manual edit. Please regenerate this file after fixing the source README.rst.

References
  1. Manual changes to auto-generated files like index.html will be overwritten. Fixes should be applied to the source README.rst.

Comment on lines +479 to +491
<tr><td>``
spp_studio.group_studio_viewer``</td>
<td>Read event types and templates</td>
</tr>
<tr><td><tt class="docutils literal">spp_studio.group_studio_editor_officer</tt></td>
<tr><td><tt class="docutils literal">spp_stud
io.group_studio_editor_officer</tt></td>
<td>Read/Write/Create on event
types, fields, and templates (no
delete on event
types/fields/templates)</td>
</tr>
<tr><td><tt class="docutils literal">spp_studio.group_studio_manager</tt></td>
<tr><td><tt class="docutils literal">s
pp_studio.group_studio_manager</tt></td>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The 'Security' table in the HTML description is corrupted. Raw backticks are used instead of proper HTML tags for code literals, and the content is incorrectly wrapped. Please ensure the HTML is correctly generated by fixing the source README.rst, as manual changes to this file will be overwritten.

References
  1. Manual changes to auto-generated files like index.html will be overwritten. Fixes should be applied to the source README.rst.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.68%. Comparing base (32a5c78) to head (e0ff3c6).
⚠️ Report is 5 commits behind head on 19.0.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #191      +/-   ##
==========================================
- Coverage   71.69%   71.68%   -0.01%     
==========================================
  Files         942      952      +10     
  Lines       55561    56436     +875     
==========================================
+ Hits        39835    40458     +623     
- Misses      15726    15978     +252     
Flag Coverage Δ
spp_base_common 90.26% <ø> (ø)
spp_programs 64.77% <ø> (ø)
spp_security 66.66% <ø> (ø)
spp_studio_events 71.20% <100.00%> (?)

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

Files with missing lines Coverage Δ
spp_studio_events/__manifest__.py 0.00% <ø> (ø)
spp_studio_events/models/studio_event_type.py 88.23% <ø> (ø)
spp_studio_events/wizard/create_event_wizard.py 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

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

1 participant