-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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
modulesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @kiga-odoo
Some comments
Thanks!!
A sample module to add filters in Appointment Website View | ||
""", | ||
|
||
'application': True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no need for this
<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"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary blank line
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why separate templates for filters i think we can add all the filters in same tempalate.
module:
event_ticket_registration_limit
event.event.ticket
asmax_tickets_per_registration
to limit the number of tickets per registration.
event.event_event_ticket_view_tree_from_event
andwebsite.website_event.modal_ticket_registration
views to add the fieldtask-4504632
module:
website_appointment_filters
task-4505947
module:
sale_extension
task-4496358