mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[RFC] pms_api_rest: rename reservation datamodel fields
This commit is contained in:
committed by
Darío Lodeiros
parent
0efad8a906
commit
14f8dd8059
@@ -16,7 +16,7 @@ class PmsReservationShortInfo(Datamodel):
|
||||
stateCode = fields.String(required=False, allow_none=True)
|
||||
stateDescription = fields.String(required=False, allow_none=True)
|
||||
children = fields.Integer(required=False, allow_none=True)
|
||||
paymentStateDescription = fields.String(required=False, allow_none=True)
|
||||
paymentState = fields.String(required=False, allow_none=True)
|
||||
readyForCheckin = fields.Boolean(required=False, allow_none=True)
|
||||
allowedCheckout = fields.Boolean(required=False, allow_none=True)
|
||||
splitted = fields.Boolean(required=False, allow_none=True)
|
||||
|
||||
@@ -7,7 +7,7 @@ class PmsResCountriesInfo(Datamodel):
|
||||
_name = "res.country.info"
|
||||
id = fields.Integer(required=False, allow_none=True)
|
||||
name = fields.String(required=False, allow_none=True)
|
||||
alpha3 = fields.String(required=False, allow_none=True)
|
||||
code = fields.String(required=False, allow_none=True)
|
||||
|
||||
|
||||
class PmsResCountryStatesInfo(Datamodel):
|
||||
|
||||
@@ -159,9 +159,7 @@ class PmsPartnerService(Component):
|
||||
reservation = self.env["pms.reservation"].search(
|
||||
[("id", "=", checkin.reservation_id.id)]
|
||||
)
|
||||
folio = self.env["pms.folio"].search(
|
||||
[("id", "=", reservation.folio_id.id)]
|
||||
)
|
||||
|
||||
reservations.append(
|
||||
PmsReservationShortInfo(
|
||||
id=reservation.id,
|
||||
@@ -169,14 +167,8 @@ class PmsPartnerService(Component):
|
||||
checkout=reservation.checkout.strftime("%d/%m/%Y"),
|
||||
adults=reservation.adults,
|
||||
priceTotal=round(reservation.price_room_services_set, 2),
|
||||
stateDescription=dict(
|
||||
reservation.fields_get(["state"])["state"]["selection"]
|
||||
)[reservation.state],
|
||||
paymentStateDescription=dict(
|
||||
folio.fields_get(["payment_state"])["payment_state"][
|
||||
"selection"
|
||||
]
|
||||
)[folio.payment_state],
|
||||
stateCode=reservation.state,
|
||||
paymentState=reservation.folio_payment_state,
|
||||
)
|
||||
)
|
||||
return reservations
|
||||
@@ -219,7 +211,6 @@ class PmsPartnerService(Component):
|
||||
PmsReservationShortInfo = self.env.datamodels["pms.reservation.short.info"]
|
||||
reservations = []
|
||||
for reservation in partnerReservations:
|
||||
folio = self.env["pms.folio"].search([("id", "=", reservation.folio_id.id)])
|
||||
reservations.append(
|
||||
PmsReservationShortInfo(
|
||||
checkin=datetime.combine(
|
||||
@@ -230,14 +221,8 @@ class PmsPartnerService(Component):
|
||||
).isoformat(),
|
||||
adults=reservation.adults,
|
||||
priceTotal=round(reservation.price_room_services_set, 2),
|
||||
stateDescription=dict(
|
||||
reservation.fields_get(["state"])["state"]["selection"]
|
||||
)[reservation.state],
|
||||
paymentStateDescription=dict(
|
||||
folio.fields_get(["payment_state"])["payment_state"][
|
||||
"selection"
|
||||
]
|
||||
)[folio.payment_state],
|
||||
stateCode=reservation.state,
|
||||
paymentState=reservation.folio_payment_state,
|
||||
)
|
||||
)
|
||||
return reservations
|
||||
@@ -382,6 +367,7 @@ class PmsPartnerService(Component):
|
||||
nationality=doc_number.partner_id.nationality_id.id
|
||||
if doc_number.partner_id.nationality_id
|
||||
else None,
|
||||
# aquí tiene que ser id
|
||||
countryState=doc_number.partner_id.residence_state_id.id
|
||||
if doc_number.partner_id.residence_state_id
|
||||
else None,
|
||||
|
||||
@@ -29,7 +29,7 @@ class ResCountryService(Component):
|
||||
ResCountriesInfo(
|
||||
id=country.id,
|
||||
name=country.name,
|
||||
alpha3=country.code_alpha3 if country.code_alpha3 else None,
|
||||
code=country.code if country.code else None,
|
||||
)
|
||||
)
|
||||
return result_countries
|
||||
|
||||
Reference in New Issue
Block a user