2014-03-13 01:56:09 |
Gerard Glenn Dalisay |
description |
When i create a new reservation and add room lines, the room appears to be occupied, but if you take a look at the reservation summary the room is free for that particular period (expected-date-of-arrival,expected-date-of-departure).
I dig into the code hotel_reservation.py:
def cron_room_line(self, cr, uid, context=None):
reservation_line_obj = self.pool.get('hotel.room.reservation.line')
now = datetime.datetime.now()
curr_date = now.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
room_ids = self.search(cr, uid, [], context=context)
for room in self.browse(cr, uid, room_ids, context=context):
status = {}
reservation_line_ids = [reservation_line.id for reservation_line in room.room_reservation_line_ids]
reservation_line_ids = reservation_line_obj.search(cr, uid, [('id', 'in', reservation_line_ids), ('check_in', '<=', curr_date), ('check_out', '>=', curr_date)], context=context)
if reservation_line_ids:
status = {'status': 'occupied'}
else:
status = {'status': 'available'}
self.write(cr, uid, [room.id], status, context=context)
return True
Notice that 'check_in' and 'check_out' is compared to the server current date 'curr_date', maybe that is the cause of rooms appearing to be occupied instead of available, coz its not being compared to the expected_arrival_date and expected_departure_date. |
When i create a new reservation and add room lines, the room appears to be occupied, but if you take a look at the reservation summary the room is free for that particular period (expected-date-of-arrival,expected-date-of-departure). |
|