mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Other py guide lines
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user