From 6d98249eae8053cca602204f9e8ffaa5605db294 Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Tue, 24 Sep 2019 19:11:19 +0200 Subject: [PATCH] [IMP] Other py guide lines --- hotel/models/hotel_room_closure_reason.py | 7 +++++-- hotel/models/hotel_room_type_class.py | 12 +++++++++--- hotel/models/hotel_room_type_restriction_item.py | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hotel/models/hotel_room_closure_reason.py b/hotel/models/hotel_room_closure_reason.py index 8556c2f60..a6940cb1a 100644 --- a/hotel/models/hotel_room_closure_reason.py +++ b/hotel/models/hotel_room_closure_reason.py @@ -9,6 +9,9 @@ class RoomClosureReason(models.Model): # Fields declaration name = fields.Char('Name', translate=True, required=True) - hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False, - ondelete='restrict') + hotel_ids = fields.Many2many( + 'hotel.property', + string='Hotels', + required=False, + ondelete='restrict') description = fields.Text('Description', translate=True) diff --git a/hotel/models/hotel_room_type_class.py b/hotel/models/hotel_room_type_class.py index 28296160a..6cdb7444e 100644 --- a/hotel/models/hotel_room_type_class.py +++ b/hotel/models/hotel_room_type_class.py @@ -16,9 +16,15 @@ class HotelRoomTypeClass(models.Model): name = fields.Char('Class Name', required=True, translate=True) # Relationship between models - hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False, - ondelete='restrict') - room_type_ids = fields.One2many('hotel.room.type', 'class_id', 'Types') + hotel_ids = fields.Many2many( + 'hotel.property', + string='Hotels', + required=False, + ondelete='restrict') + room_type_ids = fields.One2many( + 'hotel.room.type', + 'class_id', + 'Types') code_class = fields.Char('Code') active = fields.Boolean('Active', default=True) sequence = fields.Integer('Sequence', default=0) diff --git a/hotel/models/hotel_room_type_restriction_item.py b/hotel/models/hotel_room_type_restriction_item.py index e718349a7..ced5e70f8 100644 --- a/hotel/models/hotel_room_type_restriction_item.py +++ b/hotel/models/hotel_room_type_restriction_item.py @@ -7,6 +7,7 @@ from odoo.exceptions import ValidationError class HotelRoomTypeRestrictionItem(models.Model): _name = 'hotel.room.type.restriction.item' + # Field Declarations restriction_id = fields.Many2one('hotel.room.type.restriction', 'Restriction Plan', ondelete='cascade', index=True) @@ -26,6 +27,7 @@ class HotelRoomTypeRestrictionItem(models.Model): 'unique(restriction_id, room_type_id, date)', 'Only can exists one restriction in the same day for the same room type!')] + # Constraints and onchanges @api.multi @api.constrains('min_stay', 'min_stay_arrival', 'max_stay', 'max_stay_arrival')