mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] Checkin/out, arrival, partner, etc. in new checkin
This commit is contained in:
committed by
Dario Lodeiros
parent
774c86cb6b
commit
67f55b92bb
@@ -20,18 +20,16 @@ class HotelFolio(models.Model):
|
|||||||
if not stay.get('ReservationCode'):
|
if not stay.get('ReservationCode'):
|
||||||
reservation_obj = self.env['hotel.reservation']
|
reservation_obj = self.env['hotel.reservation']
|
||||||
vals = {
|
vals = {
|
||||||
'checkin': datetime.strptime(
|
'checkin': stay["Arrival"],
|
||||||
stay["Arrival"], DEFAULT_ROOMMATIK_DATE_FORMAT).date(),
|
'checkout': stay["Departure"],
|
||||||
'checkout': datetime.strptime(
|
|
||||||
stay["Departure"], DEFAULT_ROOMMATIK_DATE_FORMAT).date(),
|
|
||||||
'adults': stay['Adults'],
|
'adults': stay['Adults'],
|
||||||
'Arrival_hour': stay['arrival_hour'],
|
'arrival_hour': stay['Arrival_hour'],
|
||||||
'room_type_id': stay['RoomType'],
|
'room_type_id': stay['RoomType']['Id'],
|
||||||
'partner_id': stay["Customers"][0]["Id"]
|
'partner_id': stay["Customers"][0]["Id"]
|
||||||
}
|
}
|
||||||
reservation_rm = reservation_obj.create(vals)
|
reservation_rm = reservation_obj.create(vals)
|
||||||
else:
|
else:
|
||||||
reservation_rm = self.env['hotel.reservation'].sudo().browse(
|
reservation_rm = self.env['hotel.reservation'].browse(
|
||||||
stay['ReservationCode'])
|
stay['ReservationCode'])
|
||||||
total_chekins = reservation_rm.checkin_partner_pending_count
|
total_chekins = reservation_rm.checkin_partner_pending_count
|
||||||
if total_chekins > 0 and len(stay["Customers"]) <= total_chekins:
|
if total_chekins > 0 and len(stay["Customers"]) <= total_chekins:
|
||||||
@@ -43,14 +41,12 @@ class HotelFolio(models.Model):
|
|||||||
checkin_partner_val = {
|
checkin_partner_val = {
|
||||||
'folio_id': reservation_rm.folio_id.id,
|
'folio_id': reservation_rm.folio_id.id,
|
||||||
'reservation_id': reservation_rm.id,
|
'reservation_id': reservation_rm.id,
|
||||||
'enter_date': datetime.strptime(
|
'partner_id': room_partner["Id"],
|
||||||
stay["Arrival"], DEFAULT_ROOMMATIK_DATE_FORMAT).date(),
|
'enter_date': stay["Arrival"],
|
||||||
'exit_date': datetime.strptime(
|
'exit_date': stay["Departure"],
|
||||||
stay["Departure"], DEFAULT_ROOMMATIK_DATE_FORMAT).date(),
|
|
||||||
'partner_id': room_partner["Customer"]["Id"],
|
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
record = self.env['hotel.checkin.partner'].sudo().create(
|
record = self.env['hotel.checkin.partner'].create(
|
||||||
checkin_partner_val)
|
checkin_partner_val)
|
||||||
_logger.info('ROOMMATIK check-in partner: %s in \
|
_logger.info('ROOMMATIK check-in partner: %s in \
|
||||||
(%s Reservation) ID:%s.',
|
(%s Reservation) ID:%s.',
|
||||||
|
|||||||
Reference in New Issue
Block a user