mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms_api_rest: added reselling field in reservation line datamodel, GET and PATCH
This commit is contained in:
@@ -69,6 +69,7 @@ class PmsCalendarInfo(Datamodel):
|
||||
closureReasonId = fields.Number(required=False, allow_none=True)
|
||||
priceDayTotal = fields.Number(required=False, allow_none=True)
|
||||
priceDayTotalServices = fields.Number(required=False, allow_none=True)
|
||||
isReselling = fields.Boolean(required=False, allow_none=False)
|
||||
|
||||
|
||||
class PmsCalendarAlertsPerDay(Datamodel):
|
||||
|
||||
@@ -22,3 +22,4 @@ class PmsReservationLineInfo(Datamodel):
|
||||
roomId = fields.Integer(required=False, allow_none=False)
|
||||
reservationId = fields.Integer(required=False, allow_none=False)
|
||||
pmsPropertyId = fields.Integer(required=False, allow_none=False)
|
||||
isReselling = fields.Boolean(required=False, allow_none=True)
|
||||
|
||||
@@ -59,6 +59,7 @@ class PmsCalendarService(Component):
|
||||
"adults": "reservation.adults",
|
||||
"price_day_total": "night.price_day_total",
|
||||
"closure_reason_id": "folio.closure_reason_id",
|
||||
"is_reselling": "reservation.is_reselling",
|
||||
# "price_day_total_services": subselect_sum_services_price,
|
||||
}
|
||||
selected_fields_sql = list(selected_fields_mapper.values())
|
||||
@@ -152,6 +153,7 @@ class PmsCalendarService(Component):
|
||||
nextLineSplitted=next_line_splitted,
|
||||
previousLineSplitted=previous_line_splitted,
|
||||
closureReasonId=line["closure_reason_id"],
|
||||
isReselling=line["is_reselling"],
|
||||
)
|
||||
)
|
||||
return result_lines
|
||||
|
||||
@@ -43,6 +43,7 @@ class PmsReservationLineService(Component):
|
||||
roomId=reservation_line.room_id.id,
|
||||
reservationId=reservation_line.reservation_id.id,
|
||||
pmsPropertyId=reservation_line.pms_property_id.id,
|
||||
isReselling=reservation_line.is_reselling,
|
||||
)
|
||||
else:
|
||||
raise MissingError(_("Reservation Line not found"))
|
||||
@@ -126,6 +127,8 @@ class PmsReservationLineService(Component):
|
||||
vals["cancel_discount"] = reservation_line_info.cancelDiscount
|
||||
if reservation_line_info.roomId:
|
||||
vals["room_id"] = reservation_line_info.roomId
|
||||
if reservation_line_info.isReselling is not None:
|
||||
vals["is_reselling"] = reservation_line_info.isReselling
|
||||
reservation_line.write(vals)
|
||||
else:
|
||||
raise MissingError(_("Reservation Line not found"))
|
||||
|
||||
@@ -321,6 +321,7 @@ class PmsReservationService(Component):
|
||||
roomId=reservation_line.room_id.id,
|
||||
reservationId=reservation_line.reservation_id.id,
|
||||
pmsPropertyId=reservation_line.pms_property_id.id,
|
||||
isReselling=reservation_line.is_reselling,
|
||||
)
|
||||
)
|
||||
return result_lines
|
||||
|
||||
Reference in New Issue
Block a user