mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] constrain shared room type
This commit is contained in:
@@ -109,17 +109,17 @@ class HotelRoomType(models.Model):
|
|||||||
})
|
})
|
||||||
return super().create(vals)
|
return super().create(vals)
|
||||||
|
|
||||||
@api.constrains('shared_room', 'room_ids')
|
# @api.constrains('shared_room', 'room_ids')
|
||||||
def _constrain_shared_room(self):
|
# def _constrain_shared_room(self):
|
||||||
for record in self:
|
# for record in self:
|
||||||
if record.shared_room:
|
# if record.shared_room:
|
||||||
if any(not room.shared_room_id for room in record.room_ids):
|
# if any(not room.shared_room_id for room in record.room_ids):
|
||||||
raise ValidationError(_('We cant save normal rooms \
|
# raise ValidationError(_('We cant save normal rooms \
|
||||||
in a shared room type'))
|
# in a shared room type'))
|
||||||
else:
|
# else:
|
||||||
if any(room.shared_room_id for room in record.room_ids):
|
# if any(room.shared_room_id for room in record.room_ids):
|
||||||
raise ValidationError(_('We cant save shared rooms \
|
# raise ValidationError(_('We cant save shared rooms \
|
||||||
in a normal room type'))
|
# in a normal room type'))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user