mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Merge pull request #71 from hootel/pr_node_helper
[ADD] get_room_type_planning
This commit is contained in:
@@ -10,16 +10,6 @@ class HotelRoomType(models.Model):
|
||||
|
||||
_inherit = 'hotel.room.type'
|
||||
|
||||
@api.model
|
||||
def check_availability_room_ids(self, dfrom, dto,
|
||||
room_type_id=False, notthis=[]):
|
||||
"""
|
||||
Check availability for all or specific room types between dates
|
||||
@return: A list of `ids` with free rooms
|
||||
"""
|
||||
free_rooms = super().check_availability_room_type(dfrom, dto, room_type_id, notthis)
|
||||
return free_rooms.ids
|
||||
|
||||
@api.model
|
||||
def get_room_type_availability(self, dfrom, dto, room_type_id):
|
||||
free_rooms = self.check_availability_room_type(dfrom, dto)
|
||||
@@ -62,3 +52,13 @@ class HotelRoomType(models.Model):
|
||||
min_stay = max([r['min_stay'] for r in restrictions_plan])
|
||||
|
||||
return min_stay
|
||||
|
||||
@api.model
|
||||
def get_room_type_planning(self, dfrom, dto, room_type_id):
|
||||
availability = self.get_room_type_availability(self, dfrom, dto, room_type_id)
|
||||
|
||||
price_unit = self.get_room_type_price_unit(self, dfrom, dto, room_type_id)
|
||||
|
||||
restrictions = self.get_room_type_restrictions(self, dfrom, dto, room_type_id)
|
||||
|
||||
return {'availability': availability, 'price_unit': price_unit, 'restrictions': restrictions}
|
||||
|
||||
Reference in New Issue
Block a user