Merge pull request #72 from hootel/pr_calendar_out_of_service

Show out of service reason
This commit is contained in:
Pablo
2018-12-06 16:50:17 +01:00
committed by GitHub
6 changed files with 66 additions and 18 deletions

View File

@@ -253,6 +253,19 @@
<field name="sequence">10</field>
</record>
<!-- room.closure.reason -->
<record id="hotel_room_closure_reason_0" model="room.closure.reason">
<field name="name">Maintenance</field>
<field name="description">Used for closing of rooms which require a maintenance.
You can specify the reason in the own reservation.</field>
</record>
<record id="hotel_room_closure_reason_1" model="room.closure.reason">
<field name="name">VIP Privacy</field>
<field name="description">Used for closing of rooms for extra privacy.</field>
</record>
<!-- hotel.folio -->
<!-- reservation of 1 economic room for 1 person -->
@@ -319,6 +332,20 @@
</record>
<!-- out of service room -->
<record id="hotel_folio_4" model="hotel.folio">
<field name="partner_id" ref="base.res_partner_1"/>
<field name="reservation_type">out</field>
<field name="closure_reason_id" ref="hotel_room_closure_reason_0"/>
<field name="room_lines"
eval="[(5, 0), (0, 0, {'room_type_id': ref('hotel_room_type_1'),
'checkin': DateTime.today().strftime('%Y-%m-%d'),
'checkout': (DateTime.today() + timedelta(days=2)).strftime('%Y-%m-%d'),
'state': 'confirm',
'out_service_description': 'Change of lighting',
})]"/>
</record>
<!-- out of service room -->
</data>
</odoo>

View File

@@ -64,6 +64,8 @@ class BusHotelCalendar(models.TransientModel):
vals['checkin'],
num_split,
vals['price'],
vals['reservation_type'],
vals['out_service_description'],
]
}

View File

@@ -21,7 +21,8 @@ class HotelReservation(models.Model):
json_reservations.append([
reserv.room_id.id,
reserv.id,
reserv.folio_id.partner_id.name,
reserv.folio_id.closure_reason_id.name or _('Out of service') if reserv.folio_id.reservation_type == 'out'
else reserv.folio_id.partner_id.name,
reserv.adults,
reserv.children,
reserv.checkin,
@@ -47,12 +48,15 @@ class HotelReservation(models.Model):
])
json_reservation_tooltips.update({
reserv.id: [
reserv.folio_id.partner_id.name,
_('Out of service') if reserv.folio_id.reservation_type == 'out' else reserv.folio_id.partner_id.name,
reserv.folio_id.partner_id.mobile or
reserv.folio_id.partner_id.phone or _('Undefined'),
reserv.checkin,
num_split,
reserv.folio_id.amount_total]
reserv.folio_id.amount_total,
reserv.reservation_type,
reserv.out_service_description or _('No reason given'),
]
})
return (json_reservations, json_reservation_tooltips)
@@ -68,7 +72,7 @@ class HotelReservation(models.Model):
'id': room.id,
'name': room.name,
'capacity': room.capacity,
'class_id': room.room_type_id.class_id.id,
'class_name': room.room_type_id.class_id.name,
'shared': room.shared_room,
'price': room.room_type_id
and ['pricelist', room.room_type_id.id, pricelist_id,
@@ -270,7 +274,8 @@ class HotelReservation(models.Model):
'title': ntitle,
'room_id': record.room_id.id,
'reserv_id': record.id,
'partner_name': record.partner_id.name,
'partner_name': record.closure_reason_id.name or _('Out of service') if record.reservation_type == 'out'
else record.partner_id.name,
'adults': record.adults,
'children': record.children,
'checkin': record.checkin,
@@ -288,6 +293,9 @@ class HotelReservation(models.Model):
'fix_days': record.splitted,
'overbooking': record.overbooking,
'price': record.folio_id.amount_total,
'reservation_type': record.reservation_type,
'closure_reason_id': record.closure_reason_id or None,
'out_service_description': record.out_service_description or _('No reason given')
})
@api.model
@@ -340,6 +348,8 @@ class HotelReservation(models.Model):
'checkout' in vals or 'product_id' in vals or \
'adults' in vals or 'children' in vals or \
'state' in vals or 'splitted' in vals or \
'closure_reason_id' in vals or 'out_service_description' in vals or \
'reservation_type' in vals or \
'reserve_color' in vals or \
'reserve_color_text' in vals or 'product_id' in vals or \
'parent_reservation' in vals or 'overbooking' in vals:

View File

@@ -113,7 +113,7 @@ var PMSCalendarController = AbstractController.extend({
r['id'],
r['name'],
r['capacity'],
r['class_id'],
r['class_name'],
r['shared'],
r['price']
);
@@ -122,7 +122,7 @@ var PMSCalendarController = AbstractController.extend({
'room_type_id': r['room_type_id'],
'floor_id': r['floor_id'],
'amenities': r['amenity_ids'],
'class_id': r['class_id']
'class_name': r['class_name']
});
rooms.push(nroom);
}

View File

@@ -67,7 +67,9 @@ var HotelCalendarView = AbstractRenderer.extend({
'phone': tp[1],
'arrival_hour': HotelCalendar.toMomentUTC(tp[2], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT).local().format('HH:mm'),
'num_split': tp[3],
'amount_total': Number(tp[4]).toLocaleString()
'amount_total': Number(tp[4]).toLocaleString(),
'reservation_type': tp[5],
'out_service_description': tp[6]
};
},
@@ -772,7 +774,7 @@ var HotelCalendarView = AbstractRenderer.extend({
var virtual = _.map(this.$el.find('#pms-search #virtual_list').val(), function(item){ return +item; });
var domain = [];
if (category && category.length > 0) {
domain.push(['class_id', 'in', category]);
domain.push(['class_name', 'in', category]);
}
if (floor && floor.length > 0) {
domain.push(['floor_id', 'in', floor]);

View File

@@ -70,15 +70,22 @@
<t t-name="HotelCalendar.TooltipReservation">
<div class="oe_tooltip_string"><t t-esc="name"/></div>
<ul class="oe_tooltip_technical">
<li><b>Phone:</b> <t t-esc="phone"/></li>
<li><b>Arrival Hour:</b> <t t-esc="arrival_hour"/></li>
<t t-if="num_split &gt; 1">
<li><b>Splitted:</b> <t t-esc="num_split"/></li>
</t>
<!-- FIXME: HARD CURRENCY -->
<li><b>Total Amount:</b> <t t-esc="amount_total" t-widget="monetary"/></li>
</ul>
<t t-if="reservation_type == 'normal'">
<ul class="oe_tooltip_technical">
<li><b>Phone:</b> <t t-esc="phone"/></li>
<li><b>Arrival Hour:</b> <t t-esc="arrival_hour"/></li>
<t t-if="num_split &gt; 1">
<li><b>Splitted:</b> <t t-esc="num_split"/></li>
</t>
<!-- FIXME: HARD CURRENCY -->
<li><b>Total Amount:</b> <t t-esc="amount_total" t-widget="monetary"/></li>
</ul>
</t>
<t t-elif="reservation_type == 'out'">
<ul class="oe_tooltip_technical">
<li><b>Reason:</b> <t t-esc="out_service_description"/></li>
</ul>
</t>
</t>
<t t-name="HotelCalendar.TooltipRoom">