Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

kiga-odoo
Copy link

@kiga-odoo kiga-odoo commented Jan 22, 2025

module: event_ticket_registration_limit

  • 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


module: website_appointment_filters

  • add a module to filter the appointments on website
  • filters:
    • mode [all/online/offline]
    • type [all/paid/free]
    • schedule [all/resources/users]

task-4505947


module: sale_extension

  • add wizard to list order lines to distribute the cost

task-4496358

@robodoo
Copy link

robodoo commented Jan 22, 2025

Pull request status dashboard

@kiga-odoo kiga-odoo force-pushed the 18.0-practice-task-kiga branch 3 times, most recently from 8a40f84 to eb568e1 Compare January 24, 2025 09:48
…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
@kiga-odoo kiga-odoo force-pushed the 18.0-practice-task-kiga branch from eb568e1 to bdcad1f Compare January 24, 2025 11:28
- 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
@kiga-odoo kiga-odoo force-pushed the 18.0-practice-task-kiga branch from bdcad1f to 4706d7e Compare January 24, 2025 11:37
@kiga-odoo kiga-odoo changed the title [ADD] event_ticket_registration_limit: add ticket limits per registration [ADD] event_ticket_registration_limit: add ticket limits per registration, Jan 25, 2025
@kiga-odoo kiga-odoo changed the title [ADD] event_ticket_registration_limit: add ticket limits per registration, [ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules Jan 25, 2025
@kiga-odoo kiga-odoo changed the title [ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules [ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules Jan 25, 2025
@kiga-odoo kiga-odoo changed the title [ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules [ADD] event_ticket_registration_limit, website_appointment_filters, and sale_extension modules Jan 25, 2025
Copy link

@adsh-odoo adsh-odoo left a 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,

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">

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" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

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'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary blank line

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>

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.

@kiga-odoo kiga-odoo closed this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants