[BUG] TODO: Review this relationship

This commit is contained in:
Pablo
2019-08-30 10:52:03 +02:00
parent 3fe9f2e35e
commit 75dabc275c
2 changed files with 3 additions and 4 deletions

View File

@@ -17,6 +17,9 @@ class HotelRoomTypeRestriction(models.Model):
active = fields.Boolean('Active', default=True, active = fields.Boolean('Active', default=True,
help='If unchecked, it will allow you to hide the ' help='If unchecked, it will allow you to hide the '
'restriction plan without removing it.') 'restriction plan without removing it.')
# TODO: Review this relationship.
# 1. How to create a new hotel if hotel_property.restriction_id is required?
# 2. If you delete the hotel_id from the hotel is also deleted
hotel_ids = fields.One2many('hotel.property', hotel_ids = fields.One2many('hotel.property',
'restriction_id', string='Hotel', 'restriction_id', string='Hotel',
default=_get_default_hotel, required=True) default=_get_default_hotel, required=True)

View File

@@ -21,10 +21,6 @@ class HotelRoomTypeRestrictionItem(models.Model):
closed = fields.Boolean('Closed') closed = fields.Boolean('Closed')
closed_departure = fields.Boolean('Closed Departure') closed_departure = fields.Boolean('Closed Departure')
closed_arrival = fields.Boolean('Closed Arrival') closed_arrival = fields.Boolean('Closed Arrival')
hotel_ids = fields.One2many('hotel.property',
'restriction_id', string='Restriction Plan',
store=True, readonly=True,
related='restriction_id.hotel_ids')
_sql_constraints = [('room_type_registry_unique', _sql_constraints = [('room_type_registry_unique',
'unique(restriction_id, room_type_id, date)', 'unique(restriction_id, room_type_id, date)',