[FIX] pms_api_rest: keep folio-level pricelist on folio modification#103
Open
DarioLodeiros wants to merge 1 commit into
Open
[FIX] pms_api_rest: keep folio-level pricelist on folio modification#103DarioLodeiros wants to merge 1 commit into
DarioLodeiros wants to merge 1 commit into
Conversation
On folio modification through the external API (PUT /folios/external), OTAs send the pricelist at folio level while the reservation payload may omit it. update_folio_values never wrote folio.pricelist_id and wrapper_reservations only read the reservation-level pricelistId, so reservations re-created by a modification kept the original (stale) pricelist instead of the rate sent in the modification (e.g. a booking switched to a non-refundable rate stayed flexible). Update the folio pricelist when it changes and use the folio-level pricelist as a fallback for reservations that don't carry their own, symmetric with the create flow.
Diff CoverageDiff: origin/16.0...HEAD, staged and unstaged changes
Summary
pms_api_rest/services/pms_folio_service.pyLines 2319-2331 2319 self.get_language(pms_folio_info.language)
2320 and self.get_language(pms_folio_info.language) != folio.lang
2321 ):
2322 folio_vals.update({"lang": self.get_language(pms_folio_info.language)})
! 2323 if (
2324 pms_folio_info.pricelistId
2325 and folio.pricelist_id.id != pms_folio_info.pricelistId
2326 ):
! 2327 folio_vals.update({"pricelist_id": pms_folio_info.pricelistId})
2328 reservations_vals = []
2329 if pms_folio_info.reservations:
2330 reservations_vals = self.wrapper_reservations(
2331 folio, pms_folio_info.reservations, pms_folio_info.pricelistIdLines 2527-2543 2527 # OTAs send the pricelist at folio level on modifications, while the
2528 # reservation payload may omit it. Fall back to the folio pricelist so
2529 # reservations re-created by a modification keep the right rate instead
2530 # of the stale one (symmetric with the create flow).
! 2531 reservation_pricelist_id = (
2532 info_reservation.pricelistId or folio_pricelist_id
2533 )
! 2534 if reservation_pricelist_id:
2535 if new_res or (
2536 proposed_reservation.pricelist_id.id != reservation_pricelist_id
2537 and proposed_reservation.state in ["draft", "confirm"]
2538 ):
! 2539 vals.update({"pricelist_id": reservation_pricelist_id})
2540 board_service_id = self.get_board_service_room_type_id(
2541 info_reservation.roomTypeId,
2542 folio.pms_property_id.id,
2543 info_reservation.boardServiceId, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On folio modification through the external API (
PUT /folios/external), OTAs send the pricelist at folio level while the reservation payload may omit it.update_folio_valuesnever wrotefolio.pricelist_idandwrapper_reservationsonly read the reservation-levelpricelistId, so reservations re-created by a modification kept the original (stale) pricelist instead of the rate sent in the modification (e.g. a booking switched to a non-refundable rate stayed flexible).Fix
folio.pricelist_idon modification when the incoming folio-level pricelist changes.pricelistId, symmetric with the create flow.Reproduced from real API request logs of an OTA modification.