mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] wubook import reservation
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user