From 3059d11e8a6c5900952d93116e28e55369af4940 Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Wed, 7 Nov 2018 18:05:52 +0100 Subject: [PATCH] [DEL] applied_on restrictions --- hotel/models/hotel_room_type_restriction_item.py | 11 ----------- .../views/hotel_room_type_restriction_item_views.xml | 8 ++------ hotel/views/hotel_room_type_restriction_views.xml | 4 +--- hotel/wizard/massive_changes.py | 2 -- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/hotel/models/hotel_room_type_restriction_item.py b/hotel/models/hotel_room_type_restriction_item.py index 6a3510b92..fd82480b5 100644 --- a/hotel/models/hotel_room_type_restriction_item.py +++ b/hotel/models/hotel_room_type_restriction_item.py @@ -13,11 +13,6 @@ class HotelRoomTypeRestrictionItem(models.Model): room_type_id = fields.Many2one('hotel.room.type', 'Room Type', required=True, ondelete='cascade') date = fields.Date('Date') - applied_on = fields.Selection([ - ('1_global', 'Global'), - ('0_room_type', 'Room Type')], string="Apply On", required=True, - default='0_room_type', - help='Pricelist Item applicable on selected option') min_stay = fields.Integer("Min. Stay") min_stay_arrival = fields.Integer("Min. Stay Arrival") @@ -47,9 +42,3 @@ class HotelRoomTypeRestrictionItem(models.Model): raise ValidationError( ("Max. Stay Arrival can't be less than zero")) - @api.constrains('applied_on') - def _check_applied_on(self): - for record in self: - count = record.search_count([('applied_on', '=', '1_global')]) - if count > 1: - raise ValidationError(_("Already exists an global rule")) diff --git a/hotel/views/hotel_room_type_restriction_item_views.xml b/hotel/views/hotel_room_type_restriction_item_views.xml index 64c4dbde4..f36bd7ac2 100644 --- a/hotel/views/hotel_room_type_restriction_item_views.xml +++ b/hotel/views/hotel_room_type_restriction_item_views.xml @@ -8,9 +8,7 @@
- - - + @@ -37,9 +35,7 @@ hotel.room.type.restriction.item - - - + diff --git a/hotel/views/hotel_room_type_restriction_views.xml b/hotel/views/hotel_room_type_restriction_views.xml index 7ae67cd12..cf8c6f906 100644 --- a/hotel/views/hotel_room_type_restriction_views.xml +++ b/hotel/views/hotel_room_type_restriction_views.xml @@ -18,9 +18,7 @@ - - - + diff --git a/hotel/wizard/massive_changes.py b/hotel/wizard/massive_changes.py index 1d2b1127e..7e1d93528 100644 --- a/hotel/wizard/massive_changes.py +++ b/hotel/wizard/massive_changes.py @@ -167,7 +167,6 @@ class MassiveChangesWizard(models.TransientModel): ('date_start', '>=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)), ('date_end', '<=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)), ('restriction_id', '=', record.restriction_id.id), - ('applied_on', '=', '0_room_type'), ] for room_type in room_types: @@ -185,7 +184,6 @@ class MassiveChangesWizard(models.TransientModel): 'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'restriction_id': record.restriction_id.id, 'room_type_id': room_type.id, - 'applied_on': '0_room_type', }) hotel_room_type_re_it_obj.create(vals)