mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms-api-rest: add calendar fields
This commit is contained in:
committed by
Darío Lodeiros
parent
d54344c373
commit
25f96a0fc3
@@ -6,11 +6,18 @@ from odoo.addons.datamodel.core import Datamodel
|
||||
class PmsCalendarInfo(Datamodel):
|
||||
_name = "pms.calendar.info"
|
||||
id = fields.Integer(required=False, allow_none=True)
|
||||
state = fields.String(required=False, allow_none=True)
|
||||
date = fields.String(required=False, allow_none=True)
|
||||
roomId = fields.Integer(required=False, allow_none=True)
|
||||
toAssign = fields.Boolean(required=False, allow_none=True)
|
||||
partnerId = fields.Integer(required=False, allow_none=True)
|
||||
partnerName = fields.String(required=False, allow_none=True)
|
||||
reservationId = fields.Integer(required=False, allow_none=True)
|
||||
reservationName = fields.String(required=False, allow_none=True)
|
||||
reservationType = fields.String(required=False, allow_none=True)
|
||||
isFirstDay = fields.Boolean(required=False, allow_none=True)
|
||||
isLastDay = fields.Boolean(required=False, allow_none=True)
|
||||
totalPrice = fields.Float(required=False, allow_none=True)
|
||||
pendingPayment = fields.Float(required=False, allow_none=True)
|
||||
numNotifications = fields.Integer(required=False, allow_none=True)
|
||||
adults = fields.Integer(required=False, allow_none=True)
|
||||
|
||||
@@ -44,15 +44,22 @@ class PmsCalendarService(Component):
|
||||
result_lines.append(
|
||||
PmsCalendarInfo(
|
||||
id=line.id,
|
||||
roomId=line.room_id.id,
|
||||
state=line.reservation_id.state,
|
||||
date=datetime.combine(line.date, datetime.min.time()).isoformat(),
|
||||
roomId=line.room_id.id,
|
||||
toAssign=line.reservation_id.to_assign,
|
||||
partnerId=line.reservation_id.partner_id.id or None,
|
||||
partnerName=line.reservation_id.partner_name or None,
|
||||
reservationId=line.reservation_id,
|
||||
reservationName=line.reservation_id.name,
|
||||
reservationType=line.reservation_id.reservation_type,
|
||||
isFirstDay=line.reservation_id.checkin == line.date,
|
||||
isLastDay=line.reservation_id.checkout
|
||||
== (line.date + timedelta(days=1)),
|
||||
totalPrice=line.reservation_id.price_total,
|
||||
pendingPayment=line.reservation_id.folio_pending_amount,
|
||||
numNotifications=len(line.reservation_id.message_ids),
|
||||
adults=line.reservation_id.adults,
|
||||
)
|
||||
)
|
||||
return result_lines
|
||||
|
||||
Reference in New Issue
Block a user