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:
@@ -3,15 +3,17 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import models, fields
|
||||
|
||||
class HotelRoomAmenitie(models.Model):
|
||||
|
||||
class HotelRoomAmenity(models.Model):
|
||||
_name = 'hotel.amenity'
|
||||
_description = 'Room amenities'
|
||||
|
||||
# Fields declaration
|
||||
name = fields.Char('Amenity Name', translate=True, required=True)
|
||||
active = fields.Boolean('Active', default=True)
|
||||
hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False, ondelete='restrict')
|
||||
default_code = fields.Char('Internal Reference')
|
||||
room_amenity_type_id = fields.Many2one('hotel.amenity.type',
|
||||
'Amenity Catagory')
|
||||
hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False, ondelete='restrict')
|
||||
'Amenity Category')
|
||||
active = fields.Boolean('Active', default=True)
|
||||
|
||||
#TODO: Constrain coherence hotel_ids with amenity types hotel_ids
|
||||
# TODO: Constrain coherence hotel_ids with amenity types hotel_ids
|
||||
|
||||
@@ -4,15 +4,16 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class HotelRoomAmenitieType(models.Model):
|
||||
class HotelRoomAmenityType(models.Model):
|
||||
_name = 'hotel.amenity.type'
|
||||
_description = 'Amenities Type'
|
||||
|
||||
name = fields.Char('Amenity Name', translate=True, required=True)
|
||||
active = fields.Boolean('Active', default=True)
|
||||
# Fields declaration
|
||||
name = fields.Char('Amenity Type Name', translate=True, required=True)
|
||||
hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False, ondelete='restrict')
|
||||
room_amenity_ids = fields.One2many('hotel.amenity',
|
||||
'room_amenity_type_id',
|
||||
'Amenities in this category')
|
||||
hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False, ondelete='restrict')
|
||||
active = fields.Boolean('Active', default=True)
|
||||
|
||||
#TODO: Constrain coherence hotel_ids with amenities hotel_ids
|
||||
# TODO: Constrain coherence hotel_ids with amenities hotel_ids
|
||||
|
||||
@@ -12,6 +12,7 @@ class HotelProperty(models.Model):
|
||||
_description = 'Hotel'
|
||||
_inherits = {'res.partner': 'partner_id'}
|
||||
|
||||
# Fields declaration
|
||||
partner_id = fields.Many2one('res.partner', 'Hotel Property',
|
||||
required=True, delegate=True, ondelete='cascade')
|
||||
company_id = fields.Many2one('res.company', help='The company that owns or operates this hotel.',
|
||||
@@ -43,6 +44,7 @@ class HotelProperty(models.Model):
|
||||
default_cancel_policy_days = fields.Integer('Cancellation Days')
|
||||
default_cancel_policy_percent = fields.Float('Percent to pay')
|
||||
|
||||
# Constraints and onchanges
|
||||
@api.constrains('default_arrival_hour', 'default_departure_hour')
|
||||
def _check_hours(self):
|
||||
r = re.compile('[0-2][0-9]:[0-5][0-9]')
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class RoomClosureReason(models.Model):
|
||||
_name = "room.closure.reason"
|
||||
_description = "Cause of out of service"
|
||||
|
||||
# Fields declaration
|
||||
name = fields.Char('Name', translate=True, required=True)
|
||||
description = fields.Text('Description', translate=True)
|
||||
hotel_ids = fields.Many2many('hotel.property', string='Hotels', required=False,
|
||||
ondelete='restrict')
|
||||
description = fields.Text('Description', translate=True)
|
||||
|
||||
Reference in New Issue
Block a user