[REF] attribute and methods order guidelines

Business fields and methods arranged by importance
This commit is contained in:
Pablo
2019-09-16 12:15:48 +02:00
parent 18b9de789f
commit d568538263
12 changed files with 147 additions and 131 deletions

View File

@@ -14,8 +14,8 @@ class HotelRoom(models.Model):
_description = 'Hotel Room'
_order = "sequence, room_type_id, name"
# Fields declaration
name = fields.Char('Room Name', required=True)
# Relationship between models
hotel_id = fields.Many2one('hotel.property', store=True, readonly=True,
related='room_type_id.hotel_id')
room_type_id = fields.Many2one('hotel.room.type', 'Hotel Room Type',

View File

@@ -15,11 +15,12 @@ class HotelRoomType(models.Model):
_inherits = {'product.product': 'product_id'}
_order = "sequence, code_type, name"
# Default methods
@api.model
def _get_default_hotel(self):
return self.env.user.hotel_id
# Relationship between models
# Fields declaration
product_id = fields.Many2one('product.product', 'Product Room Type',
required=True, delegate=True,
ondelete='cascade')