mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms-api-rest: add default fields to room types (quota & max-avail) & fix -1 as a default value
This commit is contained in:
committed by
Darío Lodeiros
parent
e0293c255e
commit
5ced9309af
@@ -17,3 +17,5 @@ class PmsRoomTypeInfo(Datamodel):
|
||||
defaultCode = fields.String(required=False, allow_none=True)
|
||||
classId = fields.Integer(required=False, allow_none=True)
|
||||
price = fields.Float(required=False, allow_none=True)
|
||||
defaultMaxAvail = fields.Integer(required=False, allow_none=True)
|
||||
defaultQuota = fields.Integer(required=False, allow_none=True)
|
||||
|
||||
@@ -171,10 +171,8 @@ class PmsAvailabilityPlanService(Component):
|
||||
closed=rule["closed"],
|
||||
closedDeparture=rule["closed_departure"],
|
||||
closedArrival=rule["closed_arrival"],
|
||||
quota=rule["quota"] if rule["quota"] != -1 else 0,
|
||||
maxAvailability=rule["max_avail"]
|
||||
if rule["max_avail"] != -1
|
||||
else 0,
|
||||
quota=rule["quota"],
|
||||
maxAvailability=rule["max_avail"],
|
||||
availabilityPlanId=availability_plan_id,
|
||||
)
|
||||
result.append(availability_plan_rule_info)
|
||||
|
||||
@@ -61,6 +61,8 @@ class PmsRoomTypeService(Component):
|
||||
defaultCode=room.default_code,
|
||||
price=round(room.list_price, 2),
|
||||
classId=room.class_id,
|
||||
defaultMaxAvail=room.default_max_avail,
|
||||
defaultQuota=room.default_quota,
|
||||
)
|
||||
)
|
||||
return result_rooms
|
||||
|
||||
Reference in New Issue
Block a user