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