Skip to content

Commit 94dc9b8

Browse files
FlorianGilbertvpan-odoo
authored and
vpan-odoo
committed
[FIX] README.md: Fixing typos
There are 2 typos in the README.md that lead to broken links. closes odoo#196 X-original-commit: 460af3f Signed-off-by: Antoine Vandevenne (anv) <[email protected]>
1 parent 4f1d255 commit 94dc9b8

File tree

6 files changed

+125
-2
lines changed

6 files changed

+125
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Odoo tutorials
22

33
This repository hosts the code for the bases of the modules used in the
4-
[official Odoo tutorials](https://www.odoo.com/documentation/lastest/developer/tutorials.html).
4+
[official Odoo tutorials](https://www.odoo.com/documentation/latest/developer/tutorials.html).
55

66
It has 3 branches for each Odoo version: one for the bases, one for the
77
[Discover the JS framework](https://www.odoo.com/documentation/latest/developer/tutorials/discover_js_framework.html)
88
tutorial's solutions, and one for the
9-
[Master the Odoo web framework](https://www.odoo.com/documentation/lastest/developer/tutorials/master_odoo_web_framework.html)
9+
[Master the Odoo web framework](https://www.odoo.com/documentation/latest/developer/tutorials/master_odoo_web_framework.html)
1010
tutorial's solutions. For example, `17.0`, `17.0-discover-js-framework-solutions` and
1111
`17.0-master-odoo-web-framework-solutions`.

appointment_filter/__init__.py

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

appointment_filter/__manifest__.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "appointment_filter",
3+
"description": "An extension module of website appointment module which helps to filter data",
4+
"summary": "Enhancing User Experience by adding filters in website view",
5+
"depends": ["base","website_appointment","appointment_account_payment"],
6+
"author": "Vedant Pandey (vpan)",
7+
"category": "Website",
8+
"version": "1.0",
9+
"data": [
10+
"views/appointment_filter_template.xml"
11+
],
12+
"installable": True,
13+
"license":"LGPL-3",
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import appointment_filters
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
from odoo import http
2+
from odoo.http import request
3+
from odoo.addons.website_appointment.controllers.appointment import WebsiteAppointment
4+
5+
class WebsiteAppointmentFiltered(WebsiteAppointment):
6+
7+
@http.route()
8+
def appointment_type_index(self, page=1, **kwargs):
9+
available_domain = self._appointment_website_domain()
10+
extra_domain = []
11+
12+
if kwargs.get("appointment_type"):
13+
if kwargs["appointment_type"] == "online":
14+
extra_domain.append(("location_id", "=", False))
15+
elif kwargs["appointment_type"] == "offline":
16+
extra_domain.append(("location_id", "!=", False))
17+
18+
if kwargs.get("payment_step") == "required":
19+
extra_domain.append(("has_payment_step", "=", True))
20+
elif kwargs.get("payment_step") == "not_required":
21+
extra_domain.append(("has_payment_step", "=", False))
22+
23+
if kwargs.get("schedule_based_on"):
24+
if kwargs["schedule_based_on"] == "users":
25+
extra_domain.append(("schedule_based_on", "=", "users"))
26+
elif kwargs["schedule_based_on"] == "resources":
27+
extra_domain.append(("schedule_based_on", "=", "resources"))
28+
29+
if kwargs.get("search"):
30+
extra_domain.append(("name", "ilike", kwargs["search"]))
31+
32+
final_domain = available_domain + extra_domain
33+
appointments = request.env["appointment.type"].sudo().search(final_domain)
34+
35+
# Pass kwargs to persist filters in pagination
36+
values = self._prepare_appointments_cards_data(
37+
appointment_types=appointments,
38+
page=page,
39+
**kwargs # Ensures all filters persist in pagination
40+
)
41+
42+
return request.render("website_appointment.appointments_cards_layout", values)
43+
44+
def _prepare_appointments_cards_data(self, page, appointment_types, **kwargs):
45+
"""
46+
Compute specific data for the cards layout, ensuring filters persist in pagination.
47+
"""
48+
APPOINTMENTS_PER_PAGE = 12
49+
website = request.website
50+
appointment_count = len(appointment_types)
51+
52+
pager = website.pager(
53+
url='/appointment',
54+
url_args=kwargs, # Keeps filters in pagination
55+
total=appointment_count,
56+
page=page,
57+
step=APPOINTMENTS_PER_PAGE,
58+
scope=5,
59+
)
60+
61+
appointment_types = appointment_types.sorted('is_published', reverse=True)[pager['offset']:pager['offset'] + APPOINTMENTS_PER_PAGE]
62+
63+
return {
64+
'appointment_types': appointment_types,
65+
'current_search': kwargs.get('search'),
66+
'pager': pager,
67+
'filter_appointment_type_ids': kwargs.get('filter_appointment_type_ids'),
68+
'filter_staff_user_ids': kwargs.get('filter_staff_user_ids'),
69+
'invite_token': kwargs.get('invite_token'),
70+
'search_count': appointment_count,
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<odoo>
2+
<template id="appointment_page_with_filters" inherit_id="website_appointment.website_calendar_index_topbar">
3+
<xpath expr="//h4" position="after">
4+
<div class="dropdown">
5+
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="selectType" data-bs-toggle="dropdown" aria-expanded="false">
6+
Type
7+
</button>
8+
<ul class="dropdown-menu" aria-labelledby="selectType">
9+
<li><a class="dropdown-item" href="/appointment">All</a></li>
10+
<li><a class="dropdown-item" href="/appointment?appointment_type=online">Online</a></li>
11+
<li><a class="dropdown-item" href="/appointment?appointment_type=offline">Offline</a></li>
12+
</ul>
13+
</div>
14+
<div class="dropdown">
15+
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="hasPayment" data-bs-toggle="dropdown" aria-expanded="false">
16+
Payment Step
17+
</button>
18+
<ul class="dropdown-menu" aria-labelledby="selectType">
19+
<li><a class="dropdown-item" href="/appointment">All</a></li>
20+
<li><a class="dropdown-item" href="/appointment?payment_step=required">Paid</a></li>
21+
<li><a class="dropdown-item" href="/appointment?payment_step=not_required">Unpaid</a></li>
22+
</ul>
23+
</div>
24+
<div class="dropdown">
25+
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="hasPayment" data-bs-toggle="dropdown" aria-expanded="false">
26+
Based On
27+
</button>
28+
<ul class="dropdown-menu" aria-labelledby="selectType">
29+
<li><a class="dropdown-item" href="/appointment">All</a></li>
30+
<li><a class="dropdown-item" href="/appointment?schedule_based_on=users">Users</a></li>
31+
<li><a class="dropdown-item" href="/appointment?schedule_based_on=resources">Resources</a></li>
32+
</ul>
33+
</div>
34+
</xpath>
35+
</template>
36+
</odoo>

0 commit comments

Comments
 (0)