[ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules#237
Closed
[ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules#237
Conversation
8a40f84 to
eb568e1
Compare
…tion - add a new field to `event.event.ticket` as `max_tickets_per_registration` to limit the number of tickets per registration. - alter `event.event_event_ticket_view_tree_from_event` and `website.website_event.modal_ticket_registration` views to add the field task-4504632
eb568e1 to
bdcad1f
Compare
- add a module to filter the appointments on website
- filters:
- mode [all/online/offline]
- type [all/paid/free]
- schedule [all/resources/users]
task-4505947
…lines - add wizard to list order lines to distribute the cost task-4496358
bdcad1f to
4706d7e
Compare
event_ticket_registration_limit, website_appointment_filters, and sale_extension modules
event_ticket_registration_limit, website_appointment_filters, and sale_extension modules
adsh-odoo
reviewed
Jan 29, 2025
adsh-odoo
left a comment
There was a problem hiding this comment.
Hello @kiga-odoo
Some comments
Thanks!!
| A sample module to add filters in Appointment Website View | ||
| """, | ||
|
|
||
| 'application': True, |
| <template id="website_calendar_index_topbar_mode_filter" name="Filter by Mode" inherit_id="website_appointment.website_calendar_index_topbar"> | ||
| <xpath expr="//t[@t-call='website.website_search_box_input']" position="before"> | ||
| <t t-set="selected_mode" t-value="mode" /> | ||
| <div class="dropdown d-none d-lg-block"> |
|
|
||
| <template id="website_calendar_index_topbar_mode_filter" name="Filter by Mode" inherit_id="website_appointment.website_calendar_index_topbar"> | ||
| <xpath expr="//t[@t-call='website.website_search_box_input']" position="before"> | ||
| <t t-set="selected_mode" t-value="mode" /> |
There was a problem hiding this comment.
Suggested change
| <t t-set="selected_mode" t-value="mode" /> | |
| <t t-set="selected_mode" t-value="mode" /> |
Can't we use mode directly instead of assigning it in to a variable
Same for other occurences
Comment on lines
+12
to
+52
| if 'mode' in filters: | ||
| if filters['mode'] == 'online': | ||
| for appointment in request.env['appointment.type'].search([('location_id', '=', None)]): | ||
| filtered_appointments_by_mode.add(appointment.id) | ||
| elif filters['mode'] == 'offline': | ||
| for appointment in request.env['appointment.type'].search([('location_id', '!=', None)]): | ||
| filtered_appointments_by_mode.add(appointment.id) | ||
| elif filters['mode'] == 'all': | ||
| for appointment in request.env['appointment.type'].search([]): | ||
| filtered_appointments_by_mode.add(appointment.id) | ||
| else: | ||
| for appointment in request.env['appointment.type'].search([]): | ||
| filtered_appointments_by_mode.add(appointment.id) | ||
|
|
||
| if 'type' in filters: | ||
| if filters['type'] == 'paid': | ||
| for appointment in request.env['appointment.type'].search([('has_payment_step', '=', 'true')]): | ||
| filtered_appointments_by_type.add(appointment.id) | ||
| elif filters['type'] == 'free': | ||
| for appointment in request.env['appointment.type'].search([('has_payment_step', '!=', 'null')]): | ||
| filtered_appointments_by_type.add(appointment.id) | ||
| elif filters['type'] == 'all': | ||
| for appointment in request.env['appointment.type'].search([]): | ||
| filtered_appointments_by_type.add(appointment.id) | ||
| else: | ||
| for appointment in request.env['appointment.type'].search([]): | ||
| filtered_appointments_by_type.add(appointment.id) | ||
|
|
||
| if 'schedule' in filters: | ||
| if filters['schedule'] == 'resources': | ||
| for appointment in request.env['appointment.type'].search([('schedule_based_on', '=', 'resources')]): | ||
| filtered_appointments_by_schedule.add(appointment.id) | ||
| elif filters['schedule'] == 'users': | ||
| for appointment in request.env['appointment.type'].search([('schedule_based_on', '=', 'users')]): | ||
| filtered_appointments_by_schedule.add(appointment.id) | ||
| elif filters['schedule'] == 'all': | ||
| for appointment in request.env['appointment.type'].search([]): | ||
| filtered_appointments_by_schedule.add(appointment.id) | ||
| else: | ||
| for appointment in request.env['appointment.type'].search([]): | ||
| filtered_appointments_by_schedule.add(appointment.id) |
There was a problem hiding this comment.
I think we can improve this logic because with current implementation search is called for all the filters one by one.
Instead of that we can prepare domain from getting the values from filter and we make the final search by using that domain.
| filters['type'] = 'all' | ||
| if 'schedule' not in filters.keys(): | ||
| filters['schedule'] = 'all' | ||
|
|
Comment on lines
+26
to
+46
| <template id="website_calendar_index_topbar_type_filter" name="Filter by Type" inherit_id="website_appointment.website_calendar_index_topbar"> | ||
| <xpath expr="//t[@t-call='website.website_search_box_input']" position="before"> | ||
| <t t-set="selected_type" t-value="type" /> | ||
| <div class="dropdown d-none d-lg-block"> | ||
| <a href="#" role="button" class="btn dropdown-toggle btn-light" data-bs-toggle="dropdown" title="Filter by Type"> | ||
| Type <span t-if="selected_type != 'all'" t-out="1" class="badge bg-primary ms-1"/> | ||
| </a> | ||
| <div class="dropdown-menu"> | ||
| <span t-att-data-post="'/appointment?%s' % keep_query('*', type='all')" t-attf-class="post_link cursor-pointer dropdown-item d-flex align-items-center justify-content-between #{'active' if selected_type == 'all' else ''}"> | ||
| All | ||
| </span> | ||
| <span t-att-data-post="'/appointment?%s' % keep_query('*', type='paid')" t-attf-class="post_link cursor-pointer dropdown-item d-flex align-items-center justify-content-between #{'active' if selected_type == 'paid' else ''}"> | ||
| Paid | ||
| </span> | ||
| <span t-att-data-post="'/appointment?%s' % keep_query('*', type='free')" t-attf-class="post_link cursor-pointer dropdown-item d-flex align-items-center justify-content-between #{'active' if selected_type == 'free' else ''}"> | ||
| Free | ||
| </span> | ||
| </div> | ||
| </div> | ||
| </xpath> | ||
| </template> |
There was a problem hiding this comment.
Why separate templates for filters i think we can add all the filters in same tempalate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

module:
event_ticket_registration_limitevent.event.ticketasmax_tickets_per_registrationto limit the number of tickets per registration.
event.event_event_ticket_view_tree_from_eventandwebsite.website_event.modal_ticket_registrationviews to add the fieldtask-4504632
module:
website_appointment_filterstask-4505947
module:
sale_extensiontask-4496358