[FIX] wubook import reservation

This commit is contained in:
Pablo
2019-03-04 23:00:29 +01:00
parent 59eba7bce2
commit 0374f945fe
2 changed files with 9 additions and 6 deletions

View File

@@ -487,10 +487,13 @@ class HotelReservation(models.Model):
res = {}
checkin = values.get('checkin')
checkout = values.get('checkout')
room_type = values.get('room_type_id')
if checkin and checkout and room_type:
room_chosen = self.env['hotel.room.type'].check_availability_room_type(checkin, checkout, room_type)[0]
# Check room_chosen exist
room_type_id = values.get('room_type_id')
if checkin and checkout and room_type_id:
if 'overbooking' not in values:
room_chosen = self.env['hotel.room.type'].check_availability_room_type(checkin, checkout, room_type_id)[0]
# Check room_chosen exist
else:
room_chosen = self.env['hotel.room.type'].browse(room_type_id).room_ids[0]
res.update({
'room_id': room_chosen.id
})

View File

@@ -364,7 +364,7 @@ class HotelReservationImporter(Component):
notthis=used_rooms)
if any(free_rooms):
vals.update({
'product_id': room_type_bind.product_id.id,
'room_type_id': room_type_bind.odoo_id.id,
'name': free_rooms[0].name,
})
reservations.append((0, False, vals))
@@ -408,7 +408,7 @@ class HotelReservationImporter(Component):
book,
)
vals.update({
'product_id': room_type_bind.product_id.id,
'room_type_id': room_type_bind.odoo_id.id,
'name': room_type_bind.name,
'overbooking': True,
})