mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[DEL] applied_on restrictions
This commit is contained in:
@@ -13,11 +13,6 @@ class HotelRoomTypeRestrictionItem(models.Model):
|
||||
room_type_id = fields.Many2one('hotel.room.type', 'Room Type',
|
||||
required=True, ondelete='cascade')
|
||||
date = fields.Date('Date')
|
||||
applied_on = fields.Selection([
|
||||
('1_global', 'Global'),
|
||||
('0_room_type', 'Room Type')], string="Apply On", required=True,
|
||||
default='0_room_type',
|
||||
help='Pricelist Item applicable on selected option')
|
||||
|
||||
min_stay = fields.Integer("Min. Stay")
|
||||
min_stay_arrival = fields.Integer("Min. Stay Arrival")
|
||||
@@ -47,9 +42,3 @@ class HotelRoomTypeRestrictionItem(models.Model):
|
||||
raise ValidationError(
|
||||
("Max. Stay Arrival can't be less than zero"))
|
||||
|
||||
@api.constrains('applied_on')
|
||||
def _check_applied_on(self):
|
||||
for record in self:
|
||||
count = record.search_count([('applied_on', '=', '1_global')])
|
||||
if count > 1:
|
||||
raise ValidationError(_("Already exists an global rule"))
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Restrictions">
|
||||
<group>
|
||||
<field name="applied_on" widget="radio"/>
|
||||
<!-- <field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '1_global']]}" required="True"/> -->
|
||||
<field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '1_global']]}" required="True"/>
|
||||
<field name="room_type_id" required="True"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date"/>
|
||||
@@ -37,9 +35,7 @@
|
||||
<field name="model">hotel.room.type.restriction.item</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Restrictions">
|
||||
<field name="applied_on"/>
|
||||
<!-- <field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '1_room_type']]}"/> -->
|
||||
<field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '0_room_type']]}"/>
|
||||
<field name="room_type_id"/>
|
||||
<field name="date"/>
|
||||
<field name="min_stay"/>
|
||||
<field name="closed"/>
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
<separator string="Pricelist Items"/>
|
||||
<field name="item_ids" nolabel="1">
|
||||
<tree string="Restriction Items">
|
||||
<field name="applied_on"/>
|
||||
<!-- <field name="room_type_id" attr="{'invisible':[['applied_on', '=', '1_room_type']]}"/> -->
|
||||
<field name="room_type_id" attr="{'invisible':[['applied_on', '=', '0_room_type']]}"/>
|
||||
<field name="room_type_id"/>
|
||||
<field name="date"/>
|
||||
<field name="min_stay"/>
|
||||
<field name="closed"/>
|
||||
|
||||
@@ -167,7 +167,6 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
('date_start', '>=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)),
|
||||
('date_end', '<=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)),
|
||||
('restriction_id', '=', record.restriction_id.id),
|
||||
('applied_on', '=', '0_room_type'),
|
||||
]
|
||||
|
||||
for room_type in room_types:
|
||||
@@ -185,7 +184,6 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT),
|
||||
'restriction_id': record.restriction_id.id,
|
||||
'room_type_id': room_type.id,
|
||||
'applied_on': '0_room_type',
|
||||
})
|
||||
hotel_room_type_re_it_obj.create(vals)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user