From f07e6f049bf700bfe0c82c2d822f039e4e0bd5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Mon, 13 May 2024 11:09:35 +0200 Subject: [PATCH] [FIX]pms_api_rest: fix compute amount transactions in normalize_payments_structure --- pms_api_rest/services/pms_folio_service.py | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/pms_api_rest/services/pms_folio_service.py b/pms_api_rest/services/pms_folio_service.py index dc53b69d9..ffa8fe061 100644 --- a/pms_api_rest/services/pms_folio_service.py +++ b/pms_api_rest/services/pms_folio_service.py @@ -1906,20 +1906,22 @@ class PmsFolioService(Component): # and the sum of the price in service lines in the pms_folio_info amount_total = 0 for reservation in pms_folio_info.reservations: - amount_total += sum( - [ - line.price - (line.price * ((line.discount or 0.0) * 0.01)) - for line in reservation.reservationLines - if line.price - ] - ) - amount_total += sum( - [ - service.priceUnit * service.quantity - for service in reservation.services - if service.priceUnit and service.quantity - ] - ) + if reservation.reservationLines: + amount_total += sum( + [ + line.price - (line.price * ((line.discount or 0.0) * 0.01)) + for line in reservation.reservationLines + if line.price + ] + ) + if reservation.services: + amount_total += sum( + [ + service.priceUnit * service.quantity + for service in reservation.services + if service.priceUnit and service.quantity + ] + ) # TODO: Review where to input the data to identify payments, # as partnerRequest in the reservation doesn't seem like the best location.