Skip to content

Commit 630e34e

Browse files
author
kuay-odoo
committed
[ADD] website_appointment_filter: Add filters for type, schedule, and payment
Added new filters to improve appointment scheduling and management: Type filter- Allows users to filter appointments based on whether they are online or offline. Schedule filter- Enables filtering appointments based on users or resources, similar to the event module. Payment step filter-Adds the ability to filter appointments based on whether they include a payment step. These enhancements improve usability and provide better appointment organization.
1 parent fad6d97 commit 630e34e

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

Diff for: website_appointment_filter/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from . import controllers
1+
from . import controllers

Diff for: website_appointment_filter/__manifest__.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
"name": "Website Appointment Filter",
33
"summary": "Adds filters to website appointment",
44
"version": "1.0",
5-
"category": "Website Appointment",
65
"depends": [
76
"website_appointment",
87
"appointment_account_payment",
98
],
109
"data": [
1110
"views/website_appointment_filter.xml",
1211
],
13-
"auto-install" : True,
12+
"auto-install": True,
1413
"application": False,
15-
"license": "LGPL-3"
16-
}
14+
"license": "LGPL-3",
15+
}

Diff for: website_appointment_filter/controllers/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from . import website_appointment_filter
1+
from . import website_appointment_filter

Diff for: website_appointment_filter/controllers/website_appointment_filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def appointment_type_index(self, page=1, **params):
1616
return request.render("website_appointment.appointments_cards_layout", appointment_data)
1717

1818
def _build_filter_domain(self, params):
19-
19+
2020
domain_type = []
2121
type_dict = {
2222
"appointment_type": {

Diff for: website_appointment_filter/views/website_appointment_filter.xml

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
3-
<template id="website_appointment_filter_template" inherit_id="website_appointment.website_calendar_index_topbar">
3+
<template id="website_appointment_filter_template"
4+
inherit_id="website_appointment.website_calendar_index_topbar">
45
<xpath expr="//h4" position="after">
56
<div class="d-flex flex-grow-1 justify-content-end gap-2 px-2">
6-
<t t-set="filter_options" t-value="[
7+
<t t-set="filter_options"
8+
t-value="[
79
{
810
'title': 'Type',
911
'param': 'appointment_type',
@@ -31,22 +33,26 @@
3133
{'value': 'resources', 'label': 'Resources'}
3234
]
3335
}
34-
]"/>
36+
]" />
3537
<t t-foreach="filter_options" t-as="dropdown">
3638
<div class="dropdown">
37-
<t t-set="current_selection" t-value="request.params.get(dropdown['param'], 'all')"/>
38-
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown">
39-
<t t-esc="dropdown['title']"/>
39+
<t t-set="current_selection"
40+
t-value="request.params.get(dropdown['param'], 'all')" />
41+
<button class="btn btn-light dropdown-toggle" type="button"
42+
data-bs-toggle="dropdown">
43+
<t t-esc="dropdown['title']" />
4044
<t t-if="current_selection != 'all'">
4145
<span class="badge bg-secondary ms-2">1</span>
4246
</t>
4347
</button>
4448
<div class="dropdown-menu">
4549
<t t-foreach="dropdown['choices']" t-as="choice">
46-
<t t-set="updated_params" t-value="dict(request.params, **{dropdown['param']: choice['value']})"/>
47-
<a t-att-href="'/appointment?' + '&amp;'.join(['%s=%s' % (k, v) for k, v in updated_params.items() if v and v != 'all'])"
48-
t-att-class="'dropdown-item' + (' active' if current_selection == choice['value'] else '')">
49-
<t t-esc="choice['label']"/>
50+
<t t-set="updated_params"
51+
t-value="dict(request.params, **{dropdown['param']: choice['value']})" />
52+
<a
53+
t-att-href="'/appointment?' + '&amp;'.join(['%s=%s' % (k, v) for k, v in updated_params.items() if v and v != 'all'])"
54+
t-att-class="'dropdown-item' + (' active' if current_selection == choice['value'] else '')">
55+
<t t-esc="choice['label']" />
5056
</a>
5157
</t>
5258
</div>

0 commit comments

Comments
 (0)