Skip to content

Commit

Permalink
[MIG] website_event_membership_restriction: Migration to version 17.0
Browse files Browse the repository at this point in the history
TT51547
  • Loading branch information
pilarvargas-tecnativa committed Nov 15, 2024
1 parent 4786701 commit 64cb42f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion website_event_membership_restriction/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Website Event Membership Restriction",
"summary": "Restrict event registration to members only",
"version": "16.0.1.2.0",
"version": "17.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/event",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<field name="priority" eval="20" />
<field name="inherit_id" ref="website_event.event_event_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='auto_confirm']" position="after">
<xpath expr="//field[@name='user_id']" position="before">
<field name="registration_membership_only" />
</xpath>
</field>
Expand Down
34 changes: 8 additions & 26 deletions website_event_membership_restriction/views/event_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
priority="999"
>
<!-- Put this evaluation at the very beginning -->
<xpath expr="//div[@t-if='toast_message']" position="before">
<xpath expr="//h4" position="before">
<t t-set="user" t-value="request.env.user" />
<t t-set="partner" t-value="user.partner_id" />
<t
Expand All @@ -18,39 +18,21 @@
</xpath>
<!-- Hide the existing element and recreate it as both class and t-att-class can't coexist -->
<xpath
expr="//form//div[@id='o_wevent_tickets_collapse']//button"
expr="//button[@data-bs-target='#modal_ticket_registration']"
position="attributes"
>
<attribute name="class">d-none</attribute>
</xpath>
<xpath
expr="//form//div[@id='o_wevent_tickets_collapse']//button"
expr="//button[@data-bs-target='#modal_ticket_registration']"
position="after"
>
<button
type="submit"
t-att-class="'btn btn-primary o_wait_lazy_js a-submit ' + ('disabled' if is_disabled_for_non_members else '')"
t-attf-id="#{event.id}"
>
Register
<t
t-if="event.seats_limited and event.seats_max and event.seats_available &lt;= (event.seats_max * 0.2)"
>
(only <t t-out="event.seats_available" /> available)
</t>
</button>
<t t-if="is_disabled_for_non_members">
<a class="text-center small" href="/membership-info">Members only</a>
</t>
</xpath>
<!-- Hide the existing element and recreate it as both class and t-att-class can't coexist -->
<xpath expr="//form//div[@t-else='']//button" position="attributes">
<attribute name="class">d-none</attribute>
</xpath>
<xpath expr="//form//div[@t-else='']//button" position="after">
<button
type="submit"
t-att-class="'btn btn-primary o_wait_lazy_js a-submit ' + ('disabled' if is_disabled_for_non_members else '')"
t-if="event.event_registrations_open"
type="button"
data-bs-toggle="modal"
data-bs-target="#modal_ticket_registration"
t-att-class="'btn btn-primary w-100 ' + ('disabled' if is_disabled_for_non_members else '')"
t-attf-id="#{event.id}"
>
Register
Expand Down

0 comments on commit 64cb42f

Please sign in to comment.