mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
pre-commit
This commit is contained in:
committed by
Darío Lodeiros
parent
7d8d6bf0d6
commit
cef4d0df07
@@ -50,5 +50,4 @@ class PmsCalendarInfo(Datamodel):
|
||||
hasNextLine = fields.Boolean(required=False, allow_none=True)
|
||||
nextLineSplitted = fields.Boolean(required=False, allow_none=True)
|
||||
previousLineSplitted = fields.Boolean(required=False, allow_none=True)
|
||||
closureReason=fields.String(required=False, allow_none=True)
|
||||
|
||||
closureReason = fields.String(required=False, allow_none=True)
|
||||
|
||||
@@ -35,29 +35,25 @@ class PmsCalendarService(Component):
|
||||
domain,
|
||||
):
|
||||
next_line_splitted = False
|
||||
next_line = self.env['pms.reservation.line'].search(
|
||||
next_line = self.env["pms.reservation.line"].search(
|
||||
[
|
||||
("reservation_id", "=", line.reservation_id.id),
|
||||
("date", "=", line.date + timedelta(days=1))
|
||||
("date", "=", line.date + timedelta(days=1)),
|
||||
]
|
||||
)
|
||||
if next_line:
|
||||
next_line_splitted = next_line.room_id != line.room_id
|
||||
|
||||
previous_line_splitted = False
|
||||
previous_line = self.env['pms.reservation.line'].search(
|
||||
previous_line = self.env["pms.reservation.line"].search(
|
||||
[
|
||||
("reservation_id", "=", line.reservation_id.id),
|
||||
("date", "=", line.date + timedelta(days=-1))
|
||||
("date", "=", line.date + timedelta(days=-1)),
|
||||
]
|
||||
)
|
||||
if previous_line:
|
||||
previous_line_splitted = previous_line.room_id != line.room_id
|
||||
|
||||
closureReason= ''
|
||||
if line.reservation_id.reservation_type == 'out':
|
||||
print(line.reservation_id.closure_reason_id)
|
||||
|
||||
result_lines.append(
|
||||
PmsCalendarInfo(
|
||||
id=line.id,
|
||||
@@ -73,7 +69,8 @@ class PmsCalendarService(Component):
|
||||
reservationName=line.reservation_id.name,
|
||||
reservationType=line.reservation_id.reservation_type,
|
||||
isFirstNight=line.reservation_id.checkin == line.date,
|
||||
isLastNight=line.reservation_id.checkout + timedelta(days=-1) == line.date,
|
||||
isLastNight=line.reservation_id.checkout + timedelta(days=-1)
|
||||
== line.date,
|
||||
totalPrice=line.reservation_id.price_total,
|
||||
pendingPayment=line.reservation_id.folio_pending_amount,
|
||||
numNotifications=len(line.reservation_id.message_ids),
|
||||
@@ -81,7 +78,7 @@ class PmsCalendarService(Component):
|
||||
nextLineSplitted=next_line_splitted,
|
||||
previousLineSplitted=previous_line_splitted,
|
||||
hasNextLine=bool(next_line),
|
||||
closureReason='',
|
||||
closureReason="",
|
||||
)
|
||||
)
|
||||
return result_lines
|
||||
@@ -157,17 +154,25 @@ class PmsCalendarService(Component):
|
||||
]
|
||||
)
|
||||
|
||||
date_from = datetime.strptime(pms_calendar_search_param.date_from, '%Y-%m-%d').date()
|
||||
date_to = datetime.strptime(pms_calendar_search_param.date_to, '%Y-%m-%d').date()
|
||||
date_from = datetime.strptime(
|
||||
pms_calendar_search_param.date_from, "%Y-%m-%d"
|
||||
).date()
|
||||
date_to = datetime.strptime(
|
||||
pms_calendar_search_param.date_to, "%Y-%m-%d"
|
||||
).date()
|
||||
|
||||
result = []
|
||||
for day in (date_from + timedelta(d) for d in range((date_to-date_from).days+1)):
|
||||
reservation_lines_by_day = reservation_lines.filtered(lambda d: d.date == day)
|
||||
for day in (
|
||||
date_from + timedelta(d) for d in range((date_to - date_from).days + 1)
|
||||
):
|
||||
reservation_lines_by_day = reservation_lines.filtered(
|
||||
lambda d: d.date == day
|
||||
)
|
||||
service_lines_by_day = service_lines.filtered(lambda d: d.date == day)
|
||||
daily_invoicing = {
|
||||
"date": str(day),
|
||||
"invoicing_total":
|
||||
sum(reservation_lines_by_day.mapped("price"))+sum(service_lines_by_day.mapped("price_day_total"))
|
||||
"invoicing_total": sum(reservation_lines_by_day.mapped("price"))
|
||||
+ sum(service_lines_by_day.mapped("price_day_total")),
|
||||
}
|
||||
result.append(daily_invoicing)
|
||||
|
||||
|
||||
@@ -33,9 +33,13 @@ class PmsRoomService(Component):
|
||||
|
||||
result_rooms = []
|
||||
PmsRoomInfo = self.env.datamodels["pms.room.info"]
|
||||
for room in self.env["pms.room"].search(
|
||||
domain,
|
||||
).sorted("capacity"):
|
||||
for room in (
|
||||
self.env["pms.room"]
|
||||
.search(
|
||||
domain,
|
||||
)
|
||||
.sorted("capacity")
|
||||
):
|
||||
|
||||
result_rooms.append(
|
||||
PmsRoomInfo(
|
||||
|
||||
Reference in New Issue
Block a user