Skip to content

Commit

Permalink
Merge PR #377 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jun 6, 2024
2 parents d8b8df1 + 61e8d5e commit f64394f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions website_event_membership_restriction/views/event_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
inherit_id="website_event.registration_template"
priority="999"
>
<!-- Put this evaluation at the very beginning -->
<xpath expr="//div[@t-if='toast_message']" position="before">
<t t-set="user" t-value="request.env.user" />
<t t-set="partner" t-value="user.partner_id" />
<t
t-set="is_disabled_for_non_members"
t-value="event.registration_membership_only and (not user or (partner.commercial_partner_id.membership_state not in ['paid', 'free'] and partner.membership_state not in ['paid', 'free']))"
/>
</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"
Expand All @@ -18,10 +27,6 @@
expr="//form//div[@id='o_wevent_tickets_collapse']//button"
position="after"
>
<t
t-set="is_disabled_for_non_members"
t-value="event.registration_membership_only and (not request.env.user or request.env.user.partner_id.commercial_partner_id.membership_state not in ['paid', 'free'] or request.env.user.partner_id.membership_state not in ['paid', 'free'])"
/>
<button
type="submit"
t-att-class="'btn btn-primary o_wait_lazy_js a-submit ' + ('disabled' if is_disabled_for_non_members else '')"
Expand All @@ -43,10 +48,6 @@
<attribute name="class">d-none</attribute>
</xpath>
<xpath expr="//form//div[@t-else='']//button" position="after">
<t
t-set="is_disabled_for_non_members"
t-value="event.registration_membership_only and (not request.env.user or request.env.user.partner_id.commercial_partner_id.membership_state not in ['paid', 'free'] or request.env.user.partner_id.membership_state not in ['paid', 'free'])"
/>
<button
type="submit"
t-att-class="'btn btn-primary o_wait_lazy_js a-submit ' + ('disabled' if is_disabled_for_non_members else '')"
Expand Down

0 comments on commit f64394f

Please sign in to comment.