diff --git a/hotel/models/hotel_room_type_restriction.py b/hotel/models/hotel_room_type_restriction.py index f3723d62d..513214fea 100644 --- a/hotel/models/hotel_room_type_restriction.py +++ b/hotel/models/hotel_room_type_restriction.py @@ -4,12 +4,22 @@ from odoo import models, fields, api class HotelRoomTypeRestriction(models.Model): + """ The hotel room type restriction is used as a daily restriction plan for room types + and therefore is related only with one hotel. """ _name = 'hotel.room.type.restriction' + # Default methods + @api.model + def _get_default_hotel(self): + return self.env.user.hotel_id + + # Fields declaration name = fields.Char('Restriction Plan Name', required=True) + hotel_id = fields.Many2one('hotel.property', 'Hotel', required=True, ondelete='restrict', + default=_get_default_hotel) item_ids = fields.One2many('hotel.room.type.restriction.item', 'restriction_id', string='Restriction Items', copy=True) active = fields.Boolean('Active', default=True, help='If unchecked, it will allow you to hide the ' - 'restriction plan without removing it.') \ No newline at end of file + 'restriction plan without removing it.') diff --git a/hotel/views/hotel_room_type_restriction_views.xml b/hotel/views/hotel_room_type_restriction_views.xml index 6227988a3..f40937a79 100644 --- a/hotel/views/hotel_room_type_restriction_views.xml +++ b/hotel/views/hotel_room_type_restriction_views.xml @@ -22,7 +22,8 @@
- + +