Fix other reports

This commit is contained in:
Oscar 2021-08-03 16:35:48 -05:00
parent 75e066933a
commit c202ba6ca8
7 changed files with 22 additions and 7 deletions

View File

@ -1479,9 +1479,24 @@ class GuestsListReport(Report):
rooms = Room.search_read([])
_rooms_occupied = len(set(rooms_occupied))
occupancy_rate = round(_rooms_occupied / len(rooms), 2)
num_rooms = len(rooms)
if num_rooms:
occupancy_rate = round(_rooms_occupied / num_rooms, 2)
else:
occupancy_rate = 0
print('operations ...', operations)
report_context['records'] = operations
operations_ = []
for op in operations:
for guest in op.guests:
operations_.append({
'room': op.room.code,
'guest': guest.party.name,
'party': op.party.code,
'start_date': op.start_date,
'end_date': op.end_date,
'nights_quantity': op.nights_quantity,
})
report_context['records'] = operations_
report_context['total_rooms'] = _rooms_occupied
report_context['total_guests'] = sum(total_guests)
report_context['occupancy_rate'] = occupancy_rate

View File

@ -280,7 +280,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Rooms Occupancy Report</field>
<field name="model"></field>
<field name="report_name">hotel.rooms_occupancy.report</field>
<field name="report">hotel/rooms_occupancy.ods</field>
<field name="report">hotel/rooms_occupancy.fods</field>
<field name="template_extension">ods</field>
</record>
<record model="ir.ui.view" id="print_rooms_occupancy_start_view_form">
@ -299,7 +299,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Booking Forecast Report</field>
<field name="model"></field>
<field name="report_name">hotel.booking_forecast.report</field>
<field name="report">hotel/booking_forecast.ods</field>
<field name="report">hotel/booking_forecast.fods</field>
<field name="template_extension">ods</field>
</record>
<record model="ir.ui.view" id="print_booking_forecast_start_view_form">
@ -331,7 +331,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Guests List Report</field>
<field name="model"></field>
<field name="report_name">hotel.guests_list.report</field>
<field name="report">hotel/guests_list.ods</field>
<field name="report">hotel/guests_list.fods</field>
<field name="template_extension">ods</field>
</record>
<record model="ir.ui.view" id="print_guests_list_start_view_form">
@ -356,7 +356,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Booking Daily Report</field>
<field name="model"></field>
<field name="report_name">hotel.booking_daily.report</field>
<field name="report">hotel/booking_daily.ods</field>
<field name="report">hotel/booking_daily.fods</field>
<field name="template_extension">ods</field>
</record>
<record model="ir.ui.view" id="print_booking_daily_start_view_form">

Binary file not shown.

View File

@ -170,7 +170,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">Migration Report</field>
<field name="model"></field>
<field name="report_name">hotel.migration</field>
<field name="report">hotel/migration_report.ods</field>
<field name="report">hotel/migration_report.fods</field>
<field name="template_extension">ods</field>
</record>
<menuitem name="Migration Report" sequence="60" parent="menu_reporting"