mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[UPD] daily restriction plan for room types
This commit is contained in:
@@ -4,9 +4,19 @@ from odoo import models, fields, api
|
|||||||
|
|
||||||
|
|
||||||
class HotelRoomTypeRestriction(models.Model):
|
class HotelRoomTypeRestriction(models.Model):
|
||||||
|
""" The hotel room type restriction is used as a daily restriction plan for room types
|
||||||
|
and therefore is related only with one hotel. """
|
||||||
_name = 'hotel.room.type.restriction'
|
_name = 'hotel.room.type.restriction'
|
||||||
|
|
||||||
|
# Default methods
|
||||||
|
@api.model
|
||||||
|
def _get_default_hotel(self):
|
||||||
|
return self.env.user.hotel_id
|
||||||
|
|
||||||
|
# Fields declaration
|
||||||
name = fields.Char('Restriction Plan Name', required=True)
|
name = fields.Char('Restriction Plan Name', required=True)
|
||||||
|
hotel_id = fields.Many2one('hotel.property', 'Hotel', required=True, ondelete='restrict',
|
||||||
|
default=_get_default_hotel)
|
||||||
item_ids = fields.One2many('hotel.room.type.restriction.item',
|
item_ids = fields.One2many('hotel.room.type.restriction.item',
|
||||||
'restriction_id', string='Restriction Items',
|
'restriction_id', string='Restriction Items',
|
||||||
copy=True)
|
copy=True)
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<separator string="Pricelist Items"/>
|
<field name="hotel_id" options="{'no_create': True,'no_open': True}"/>
|
||||||
|
<separator string="Restriction Items"/>
|
||||||
<field name="item_ids" nolabel="1">
|
<field name="item_ids" nolabel="1">
|
||||||
<tree string="Restriction Items">
|
<tree string="Restriction Items">
|
||||||
<field name="room_type_id"/>
|
<field name="room_type_id"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user