Skip to content

Commit

Permalink
[IMP]pms_api_rest: Restrict to external app the creation of external …
Browse files Browse the repository at this point in the history
…references duplicated
  • Loading branch information
DarioLodeiros authored and miguelpadin committed Sep 23, 2024
1 parent 203d388 commit 264b7b9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pms_api_rest/services/pms_folio_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,9 @@ def get_folio_reservations(self, folio_id):
for reservation in sorted(
folio.reservation_ids, key=lambda r: r.folio_sequence
):
reservation_room_type_class_id = (
self.env["pms.room.type.class"]
.browse(reservation.room_type_id.sudo().class_id.id)
)
reservation_room_type_class_id = self.env[
"pms.room.type.class"
].browse(reservation.room_type_id.sudo().class_id.id)
reservations.append(
PmsReservationShortInfo(
id=reservation.id,
Expand Down Expand Up @@ -596,7 +595,7 @@ def get_folio_reservations(self, folio_id):
segmentationId=reservation.segmentation_ids[0].id
if reservation.segmentation_ids
else None,
isOverNightRoom=reservation.overnight_room
isOverNightRoom=reservation.overnight_room,
)
)

Expand Down Expand Up @@ -625,7 +624,7 @@ def create_folio(self, pms_folio_info):
pms_folio_info.reservations, key=lambda x: x.checkout
).checkout
try:
if pms_folio_info.externalReference:
if pms_folio_info.externalReference and external_app:
# If folio exists (external_reference + pms_property_id)
# ignore the creation of the folio and log the payload with "duplicate" mensaje
folio = self.env["pms.folio"].search(
Expand Down

0 comments on commit 264b7b9

Please sign in to comment.