Skip to content

Commit

Permalink
[ADD]pms_api_rest: lastUpdateFrom param in folio and reservation GET
Browse files Browse the repository at this point in the history
  • Loading branch information
DarioLodeiros committed Oct 11, 2024
1 parent 9ab22f4 commit e24210e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions pms_api_rest/datamodels/pms_folio.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class PmsFolioSearchParam(Datamodel):
ids = fields.List(fields.Integer(), required=False)
createDateFrom = fields.String(required=False, allow_none=True)
createDateTo = fields.String(required=False, allow_none=True)
lastUpdateFrom = fields.String(required=False, allow_none=True)


class PmsFolioInfo(Datamodel):
Expand Down
2 changes: 1 addition & 1 deletion pms_api_rest/datamodels/pms_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PmsReservationShortInfo(Datamodel):
reservationType = fields.String(required=False, allow_none=True)
segmentationId = fields.Integer(required=False, allow_none=True)
isOverNightRoom = fields.Boolean(required=False, allow_none=True)

lastUpdateFrom = fields.String(required=False, allow_none=True)


class PmsReservationInfo(Datamodel):
Expand Down
6 changes: 6 additions & 0 deletions pms_api_rest/services/pms_folio_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ def get_folios(self, folio_search_param):
if folio_search_param.ids:
domain_filter.append([("folio_id", "in", folio_search_param.ids)])

if folio_search_param.lastUpdateFrom:
last_update_from = fields.Datetime.from_string(
folio_search_param.lastUpdateFrom
)
domain_filter.append([("write_date", ">=", last_update_from)])

if folio_search_param.filter:
target = folio_search_param.filter
if "@" in target:
Expand Down
3 changes: 3 additions & 0 deletions pms_api_rest/services/pms_reservation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ def get_reservations(self, pms_search_param):
),
)
)
if pms_search_param.lastUpdateFrom:
last_update = fields.Datetime.from_string(pms_search_param.lastUpdateFrom)
domain.append(("write_date", ">=", last_update))

reservations = self.env["pms.reservation"].search(domain)
PmsReservationInfo = self.env.datamodels["pms.reservation.info"]
Expand Down

0 comments on commit e24210e

Please sign in to comment.