diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-04-01 14:20:07 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-03 11:07:56 +0000 |
| commit | bc1b5e134bee183072507fd86c044403b502e22b (patch) | |
| tree | 67bd8ddbfc3d1a2768a62570131c62e5db741608 /addons/website_event/views | |
| parent | b29b4bcbfc61aab1035de1f8b0cb9c796cd4bc58 (diff) | |
[FIX] website_event: better sold out computation
Purpose of this commit is to remove some complex check embedded in templates
and replace them by a computed unstored field. It eases definition and
understanding.
Its computation has been cleaned, so that sold out appears only when tickets
are really sold out, not if their end sales date is reached. Sold out label
is displayed in both event list and event specific page views in frontend.
Small spacing issues in frontend registration form are also fixed.
Task ID 2228189
Community PR odoo/odoo#48652
X-original-commit: c36cf90e7b83d2424b2f52ad8a2fec0bf367e8d8
Diffstat (limited to 'addons/website_event/views')
| -rw-r--r-- | addons/website_event/views/event_templates.xml | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/addons/website_event/views/event_templates.xml b/addons/website_event/views/event_templates.xml index c1d73b6d07b..adc517eb938 100644 --- a/addons/website_event/views/event_templates.xml +++ b/addons/website_event/views/event_templates.xml @@ -237,9 +237,13 @@ <!-- Footer --> <footer t-attf-class="small align-self-end w-100 #{opt_events_list_cards and 'card-footer' or ((not opt_events_list_columns) and 'border-top mx-4 mt-auto pt-2' or 'border-top py-2')}"> - <span class="text-danger" - t-if="event.seats_limited and not event.seats_available"> - Sold Out + <span t-if="not event.event_registrations_open" class="text-danger"> + <t t-if="event.event_registrations_sold_out"> + Sold Out + </t> + <t t-else=""> + Registrations Closed + </t> </span> </footer> </div> @@ -535,12 +539,12 @@ </t> <t t-else=""> <div class="col-md-8"> - <em t-if="not sold_out or event.date_end < datetime.datetime.now()">Registrations are <b>closed</b></em> - <em t-else="">Tickets for this Event are <b>Sold Out</b></em> + <em t-if="event.event_registrations_sold_out">Tickets for this Event are <b>Sold Out</b></em> + <em t-else="">Registrations are <b>closed</b></em> </div> - <button class="btn btn-danger ml-3 col-md-4 py-2" disabled="1"> - <span t-if="not sold_out or event.date_end < datetime.datetime.now()">Registrations Closed</span> - <span t-else="">Sold Out</span> + <button class="btn btn-danger ml-3 col-md-4 py-2" disabled="1"> + <span t-if="event.event_registrations_sold_out">Sold Out</span> + <span t-else="">Registrations Closed</span> </button> </t> </div> @@ -603,7 +607,9 @@ </div> <div class="row no-gutters"> <div class="col-md-4 offset-md-8 py-2 pl-md-0 pr-md-2"> - <button type="submit" class="btn btn-primary o_wait_lazy_js btn-block a-submit" disabled="" t-attf-id="#{event.id}">Register<t t-if="event.seats_limited">(Available seats: <t t-esc="event.seats_available"/>)</t></button> + <button type="submit" class="btn btn-primary o_wait_lazy_js btn-block a-submit" disabled="" t-attf-id="#{event.id}"> + Register<t t-if="event.seats_limited"> (Available seats: <t t-esc="event.seats_available"/>)</t> + </button> </div> </div> </div> |
