[UPD] daily restriction plan for room types

This commit is contained in:
Pablo
2019-09-18 17:21:35 +02:00
parent 87e6c1b6b9
commit fc56175520
2 changed files with 13 additions and 2 deletions

View File

@@ -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.')
'restriction plan without removing it.')

View File

@@ -22,7 +22,8 @@
</h1>
</div>
<div>
<separator string="Pricelist Items"/>
<field name="hotel_id" options="{'no_create': True,'no_open': True}"/>
<separator string="Restriction Items"/>
<field name="item_ids" nolabel="1">
<tree string="Restriction Items">
<field name="room_type_id"/>