mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[REF] attribute and methods order guidelines
Business fields and methods arranged by importance
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user