mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]14.0-pms_api_rest: added new folio filters in get_folios
This commit is contained in:
@@ -30,6 +30,7 @@ class PmsDashboardServices(Component):
|
||||
dateFrom = fields.Date.from_string(pms_dashboard_search_param.dateFrom)
|
||||
dateTo = fields.Date.from_string(pms_dashboard_search_param.dateTo)
|
||||
|
||||
# If you modify this SQL you must modify the get_folios service in pms_folio_service.py
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
SELECT
|
||||
|
||||
@@ -150,7 +150,63 @@ class PmsFolioService(Component):
|
||||
]
|
||||
domain_filter.append(expression.OR(subdomains))
|
||||
if folio_search_param.filterByState:
|
||||
if folio_search_param.filterByState == "byCheckin":
|
||||
if folio_search_param.filterByState == "checkinYesterday":
|
||||
subdomains = [
|
||||
[("state", "in", ("confirm", "arrival_delayed"))],
|
||||
[("checkin", "=", fields.Date.today() - timedelta(days=1))],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "pendingCheckinToday":
|
||||
subdomains = [
|
||||
[("state", "in", ("confirm", "arrival_delayed"))],
|
||||
[("checkin", "=", fields.Date.today())],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "completedCheckinsToday":
|
||||
subdomains = [
|
||||
[("state", "=", "onboard")],
|
||||
[("checkin", "=", fields.Date.today())],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "pendingCheckinsTomorrow":
|
||||
subdomains = [
|
||||
[("state", "=", "confirm")],
|
||||
[("checkin", "=", fields.Date.today() + timedelta(days=1))],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "pendingCheckoutsToday":
|
||||
subdomains = [
|
||||
[("state", "in", ("onboard", "departure_delayed"))],
|
||||
[("checkout", "=", fields.Date.today())],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "pendingCheckoutsTomorrow":
|
||||
subdomains = [
|
||||
[("state", "in", ("onboard", "departure_delayed"))],
|
||||
[("checkout", "=", fields.Date.today() + timedelta(days=1))],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "completedCheckoutsToday":
|
||||
subdomains = [
|
||||
[("state", "=", "done")],
|
||||
[("checkout", "=", fields.Date.today())],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "completedCheckoutsTomorrow":
|
||||
subdomains = [
|
||||
[("state", "=", "done")],
|
||||
[("checkout", "=", fields.Date.today() + timedelta(days=1))],
|
||||
[("reservation_type", "!=", "out")],
|
||||
]
|
||||
domain_filter.append(expression.AND(subdomains))
|
||||
elif folio_search_param.filterByState == "byCheckin":
|
||||
subdomains = [
|
||||
[("state", "in", ("confirm", "arrival_delayed"))],
|
||||
[("checkin", "<=", fields.Date.today())],
|
||||
|
||||
Reference in New Issue
Block a user