Skip to content

Commit 7b633c5

Browse files
committed
fix(spp_studio_events): self-explanatory step 1 for Studio-backed event types (OP#992)
1 parent 01d8261 commit 7b633c5

6 files changed

Lines changed: 190 additions & 47 deletions

File tree

spp_studio_events/README.rst

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,30 @@ Key Capabilities
5050
Key Models
5151
~~~~~~~~~~
5252

53-
+------------------------------------------+----------------------------------+
54-
| Model | Description |
55-
+==========================================+==================================+
56-
| ``spp.studio.event.type`` | Custom event type definition |
57-
| | with draft/active lifecycle |
58-
+------------------------------------------+----------------------------------+
59-
| ``spp.studio.event.field`` | Field definition with type, |
60-
| | validation, and visibility |
61-
+------------------------------------------+----------------------------------+
62-
| ``spp.studio.event.field.group`` | Groups fields into tabs in the |
63-
| | data entry wizard |
64-
+------------------------------------------+----------------------------------+
65-
| ``spp.studio.event.field.template`` | Reusable template containing |
66-
| | field definitions |
67-
+------------------------------------------+----------------------------------+
68-
| ``spp.studio.event.field.template.line`` | Field definition within a |
69-
| | template |
70-
+------------------------------------------+----------------------------------+
71-
| ``spp.studio.event.type.wizard`` | 3-step wizard for creating event |
72-
| | types |
73-
+------------------------------------------+----------------------------------+
74-
| ``spp.event.data.entry.wizard`` | Generated wizard for entering |
75-
| | event data |
76-
+------------------------------------------+----------------------------------+
53+
+----------------------------------+----------------------------------+
54+
| Model | Description |
55+
+==================================+==================================+
56+
| ``spp.studio.event.type`` | Custom event type definition |
57+
| | with draft/active lifecycle |
58+
+----------------------------------+----------------------------------+
59+
| ``spp.studio.event.field`` | Field definition with type, |
60+
| | validation, and visibility |
61+
+----------------------------------+----------------------------------+
62+
| ``spp.studio.event.field.group`` | Groups fields into tabs in the |
63+
| | data entry wizard |
64+
+----------------------------------+----------------------------------+
65+
| ``s | Reusable template containing |
66+
| pp.studio.event.field.template`` | field definitions |
67+
+----------------------------------+----------------------------------+
68+
| ``spp.st | Field definition within a |
69+
| udio.event.field.template.line`` | template |
70+
+----------------------------------+----------------------------------+
71+
| ``spp.studio.event.type.wizard`` | 3-step wizard for creating event |
72+
| | types |
73+
+----------------------------------+----------------------------------+
74+
| ``spp.event.data.entry.wizard`` | Generated wizard for entering |
75+
| | event data |
76+
+----------------------------------+----------------------------------+
7777

7878
Configuration
7979
~~~~~~~~~~~~~
@@ -99,18 +99,20 @@ UI Location
9999
Security
100100
~~~~~~~~
101101

102-
+--------------------------------------------+----------------------------------+
103-
| Group | Access |
104-
+============================================+==================================+
105-
| ``spp_studio.group_studio_viewer`` | Read event types and templates |
106-
+--------------------------------------------+----------------------------------+
107-
| ``spp_studio.group_studio_editor_officer`` | Read/Write/Create on event |
108-
| | types, fields, and templates (no |
109-
| | delete on event |
110-
| | types/fields/templates) |
111-
+--------------------------------------------+----------------------------------+
112-
| ``spp_studio.group_studio_manager`` | Full CRUD |
113-
+--------------------------------------------+----------------------------------+
102+
+----------------------------------+----------------------------------+
103+
| Group | Access |
104+
+==================================+==================================+
105+
| `` | Read event types and templates |
106+
| spp_studio.group_studio_viewer`` | |
107+
+----------------------------------+----------------------------------+
108+
| ``spp_stud | Read/Write/Create on event |
109+
| io.group_studio_editor_officer`` | types, fields, and templates (no |
110+
| | delete on event |
111+
| | types/fields/templates) |
112+
+----------------------------------+----------------------------------+
113+
| ``s | Full CRUD |
114+
| pp_studio.group_studio_manager`` | |
115+
+----------------------------------+----------------------------------+
114116

115117
Extension Points
116118
~~~~~~~~~~~~~~~~
@@ -137,6 +139,25 @@ Dependencies
137139
Changelog
138140
=========
139141

142+
19.0.2.0.2
143+
~~~~~~~~~~
144+
145+
- fix(views): the basic Create Event wizard's step 1 is now
146+
self-explanatory for Studio-backed event types. The misleading raw
147+
JSON field is hidden; an info banner announces the next stage; the
148+
"Create Event" button is renamed "Next" so users know there's a second
149+
step where the structured fields appear. Non-Studio event types keep
150+
the original step-1 UI unchanged. Backed by a new computed
151+
``is_studio_event_type`` boolean on ``spp.create.event.wizard``.
152+
153+
19.0.2.0.1
154+
~~~~~~~~~~
155+
156+
- fix(views): clicking the **Events** smart button on a Studio Event
157+
Type form no longer crashes with ``View types not defined tree``.
158+
``action_view_events`` returned ``view_mode="tree,form"``, but Odoo 19
159+
renamed ``tree`` to ``list``; switched to ``view_mode="list,form"``.
160+
140161
19.0.2.0.0
141162
~~~~~~~~~~
142163

spp_studio_events/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# pylint: disable-next=pointless-statement
22
{
33
"name": "OpenSPP Studio - Events",
4-
"version": "19.0.2.0.1",
4+
"version": "19.0.2.0.2",
55
"category": "OpenSPP/Configuration",
66
"summary": "No-code event type designer for data collection",
77
"author": "OpenSPP.org",
@@ -22,6 +22,7 @@
2222
# Wizards
2323
"wizard/event_type_wizard_views.xml",
2424
"wizard/event_data_entry_wizard_views.xml",
25+
"wizard/create_event_wizard_views.xml",
2526
# Data
2627
"data/event_field_templates.xml",
2728
],

spp_studio_events/readme/HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 19.0.2.0.2
2+
3+
- fix(views): the basic Create Event wizard's step 1 is now self-explanatory for Studio-backed event types. The misleading raw JSON field is hidden; an info banner announces the next stage; the "Create Event" button is renamed "Next" so users know there's a second step where the structured fields appear. Non-Studio event types keep the original step-1 UI unchanged. Backed by a new computed `is_studio_event_type` boolean on `spp.create.event.wizard`.
4+
15
### 19.0.2.0.1
26

37
- fix(views): clicking the **Events** smart button on a Studio Event Type form no longer crashes with `View types not defined tree`. `action_view_events` returned `view_mode="tree,form"`, but Odoo 19 renamed `tree` to `list`; switched to `view_mode="list,form"`.

spp_studio_events/static/description/index.html

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ <h1>Key Capabilities</h1>
399399
<h1>Key Models</h1>
400400
<table border="1" class="docutils">
401401
<colgroup>
402-
<col width="55%" />
403-
<col width="45%" />
402+
<col width="50%" />
403+
<col width="50%" />
404404
</colgroup>
405405
<thead valign="bottom">
406406
<tr><th class="head">Model</th>
@@ -420,11 +420,13 @@ <h1>Key Models</h1>
420420
<td>Groups fields into tabs in the
421421
data entry wizard</td>
422422
</tr>
423-
<tr><td><tt class="docutils literal">spp.studio.event.field.template</tt></td>
423+
<tr><td><tt class="docutils literal">s
424+
pp.studio.event.field.template</tt></td>
424425
<td>Reusable template containing
425426
field definitions</td>
426427
</tr>
427-
<tr><td><tt class="docutils literal">spp.studio.event.field.template.line</tt></td>
428+
<tr><td><tt class="docutils literal">spp.st
429+
udio.event.field.template.line</tt></td>
428430
<td>Field definition within a
429431
template</td>
430432
</tr>
@@ -465,25 +467,28 @@ <h1>UI Location</h1>
465467
<h1>Security</h1>
466468
<table border="1" class="docutils">
467469
<colgroup>
468-
<col width="56%" />
469-
<col width="44%" />
470+
<col width="50%" />
471+
<col width="50%" />
470472
</colgroup>
471473
<thead valign="bottom">
472474
<tr><th class="head">Group</th>
473475
<th class="head">Access</th>
474476
</tr>
475477
</thead>
476478
<tbody valign="top">
477-
<tr><td><tt class="docutils literal">spp_studio.group_studio_viewer</tt></td>
479+
<tr><td>``
480+
spp_studio.group_studio_viewer``</td>
478481
<td>Read event types and templates</td>
479482
</tr>
480-
<tr><td><tt class="docutils literal">spp_studio.group_studio_editor_officer</tt></td>
483+
<tr><td><tt class="docutils literal">spp_stud
484+
io.group_studio_editor_officer</tt></td>
481485
<td>Read/Write/Create on event
482486
types, fields, and templates (no
483487
delete on event
484488
types/fields/templates)</td>
485489
</tr>
486-
<tr><td><tt class="docutils literal">spp_studio.group_studio_manager</tt></td>
490+
<tr><td><tt class="docutils literal">s
491+
pp_studio.group_studio_manager</tt></td>
487492
<td>Full CRUD</td>
488493
</tr>
489494
</tbody>
@@ -516,6 +521,27 @@ <h2><a class="toc-backref" href="#toc-entry-1">Changelog</a></h2>
516521
</div>
517522
</div>
518523
<div class="section" id="section-1">
524+
<h1>19.0.2.0.2</h1>
525+
<ul class="simple">
526+
<li>fix(views): the basic Create Event wizard’s step 1 is now
527+
self-explanatory for Studio-backed event types. The misleading raw
528+
JSON field is hidden; an info banner announces the next stage; the
529+
“Create Event” button is renamed “Next” so users know there’s a second
530+
step where the structured fields appear. Non-Studio event types keep
531+
the original step-1 UI unchanged. Backed by a new computed
532+
<tt class="docutils literal">is_studio_event_type</tt> boolean on <tt class="docutils literal">spp.create.event.wizard</tt>.</li>
533+
</ul>
534+
</div>
535+
<div class="section" id="section-2">
536+
<h1>19.0.2.0.1</h1>
537+
<ul class="simple">
538+
<li>fix(views): clicking the <strong>Events</strong> smart button on a Studio Event
539+
Type form no longer crashes with <tt class="docutils literal">View types not defined tree</tt>.
540+
<tt class="docutils literal">action_view_events</tt> returned <tt class="docutils literal"><span class="pre">view_mode=&quot;tree,form&quot;</span></tt>, but Odoo 19
541+
renamed <tt class="docutils literal">tree</tt> to <tt class="docutils literal">list</tt>; switched to <tt class="docutils literal"><span class="pre">view_mode=&quot;list,form&quot;</span></tt>.</li>
542+
</ul>
543+
</div>
544+
<div class="section" id="section-3">
519545
<h1>19.0.2.0.0</h1>
520546
<ul class="simple">
521547
<li>Initial migration to OpenSPP2</li>

spp_studio_events/wizard/create_event_wizard.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44

5-
from odoo import _, models
5+
from odoo import _, api, fields, models
66

77
_logger = logging.getLogger(__name__)
88

@@ -12,6 +12,22 @@ class SPPCreateEventWizardStudioExtension(models.TransientModel):
1212

1313
_inherit = "spp.create.event.wizard"
1414

15+
is_studio_event_type = fields.Boolean(
16+
compute="_compute_is_studio_event_type",
17+
help=(
18+
"True when the selected event type was created via Studio and "
19+
"renders structured fields in the next stage. Drives the basic "
20+
"wizard's UX: hides the misleading raw JSON input, shows an "
21+
"info banner, and renames the submit button to 'Next' so users "
22+
"know there's a second step coming."
23+
),
24+
)
25+
26+
@api.depends("event_type_id")
27+
def _compute_is_studio_event_type(self):
28+
for rec in self:
29+
rec.is_studio_event_type = bool(rec.event_type_id and rec.event_type_id._get_active_studio_event_type())
30+
1531
def create_event(self):
1632
"""Override to redirect to Studio wizard if applicable.
1733
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<!--
4+
Inherit the basic Create Event wizard form to make step 1 of the
5+
Studio flow self-explanatory:
6+
7+
- Hide the raw JSON `event_data` field for Studio event types
8+
(it's misleading since the structured fields render in the
9+
next stage, not this one).
10+
- Insert an info banner that announces the next stage.
11+
- Replace the "Create Event" button with a "Next" button when the
12+
selected event type is Studio-backed; non-Studio types keep
13+
"Create Event" because for them this *is* the only stage.
14+
15+
See OP#992.
16+
-->
17+
<record id="view_spp_create_event_wizard_form_studio" model="ir.ui.view">
18+
<field name="name">spp.create.event.wizard.form.studio</field>
19+
<field name="model">spp.create.event.wizard</field>
20+
<field
21+
name="inherit_id"
22+
ref="spp_event_data.view_spp_create_event_wizard_form"
23+
/>
24+
<field name="arch" type="xml">
25+
<!-- Make the Studio flag readable from the view's evaluation
26+
context so the conditional attributes below work. -->
27+
<xpath expr="//field[@name='partner_id']" position="before">
28+
<field name="is_studio_event_type" invisible="1" />
29+
</xpath>
30+
31+
<!-- Info banner at the top of the sheet — full-width, only
32+
visible for Studio-backed event types. Placed before the
33+
first group so it renders as a banner above the form
34+
fields rather than as a column-neighbor of the (now
35+
hidden) JSON group. -->
36+
<xpath expr="//sheet/group[1]" position="before">
37+
<div
38+
class="alert alert-info"
39+
role="alert"
40+
invisible="not is_studio_event_type"
41+
>
42+
This event type uses <strong>structured fields</strong>.
43+
Click <strong>Next</strong> to enter them — you'll be
44+
moved to the second stage where each defined field
45+
appears as its own input.
46+
</div>
47+
</xpath>
48+
49+
<!-- Hide the raw JSON group when the event type is Studio-backed. -->
50+
<xpath expr="//field[@name='event_data']/.." position="attributes">
51+
<attribute
52+
name="invisible"
53+
>not event_type_id or is_studio_event_type</attribute>
54+
</xpath>
55+
56+
<!-- Hide the original "Create Event" button when Studio. -->
57+
<xpath expr="//footer/button[@name='create_event']" position="attributes">
58+
<attribute
59+
name="invisible"
60+
>not event_type_id or is_studio_event_type</attribute>
61+
</xpath>
62+
63+
<!-- Add a "Next" button (same backing method) for Studio types. -->
64+
<xpath expr="//footer/button[@name='create_event']" position="after">
65+
<button
66+
name="create_event"
67+
string="Next"
68+
type="object"
69+
class="oe_highlight"
70+
invisible="not is_studio_event_type"
71+
/>
72+
</xpath>
73+
</field>
74+
</record>
75+
</odoo>

0 commit comments

Comments
 (0)