Fix reports
This commit is contained in:
parent
88298cedcb
commit
75e066933a
11
booking.py
11
booking.py
|
@ -1467,7 +1467,7 @@ class GuestsListReport(Report):
|
|||
operations = Operation.search([
|
||||
('start_date', '<=', start_date),
|
||||
('kind', '=', 'occupancy'),
|
||||
('state', '=', 'check_in'),
|
||||
('state', '=', 'open'),
|
||||
], order=[('room.code', 'ASC')])
|
||||
|
||||
total_guests = []
|
||||
|
@ -1480,7 +1480,7 @@ class GuestsListReport(Report):
|
|||
|
||||
_rooms_occupied = len(set(rooms_occupied))
|
||||
occupancy_rate = round(_rooms_occupied / len(rooms), 2)
|
||||
|
||||
print('operations ...', operations)
|
||||
report_context['records'] = operations
|
||||
report_context['total_rooms'] = _rooms_occupied
|
||||
report_context['total_guests'] = sum(total_guests)
|
||||
|
@ -1544,7 +1544,7 @@ class RoomsOccupancyReport(Report):
|
|||
all_rooms = Room.search([], order=[('code', 'ASC')])
|
||||
operations = Operation.search([
|
||||
('start_date', '<=', start_date),
|
||||
('state', '=', 'check_in'),
|
||||
('state', '=', 'open'),
|
||||
('kind', '=', 'occupancy'),
|
||||
])
|
||||
|
||||
|
@ -1566,12 +1566,10 @@ class RoomsOccupancyReport(Report):
|
|||
|
||||
rooms_map = {room.id: _get_default_room(room) for room in all_rooms}
|
||||
occupancy_rooms = 0
|
||||
print(operations)
|
||||
for op in operations:
|
||||
name = op.main_guest.name if op.main_guest else op.party.name
|
||||
print(op.main_guest.name)
|
||||
rooms_map[op.room.id].update({
|
||||
'guest': op.main_guest.rec_name if op.main_guest else op.party.name,
|
||||
'guest': name,
|
||||
'num_guest': len(op.guests),
|
||||
'party': op.party.name,
|
||||
'arrival': op.start_date,
|
||||
|
@ -1590,7 +1588,6 @@ class RoomsOccupancyReport(Report):
|
|||
|
||||
user = Pool().get('res.user')(Transaction().user)
|
||||
recs = rooms_map.values()
|
||||
print(recs)
|
||||
report_context['records'] = rooms_map
|
||||
report_context['occupancy_rate'] = occupancy_rate
|
||||
report_context['occupancy_rooms'] = occupancy_rooms
|
||||
|
|
BIN
guests_list.fods
BIN
guests_list.fods
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue