mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] beds auto name
This commit is contained in:
@@ -36,33 +36,33 @@ class HotelRoom(models.Model):
|
|||||||
default='0',
|
default='0',
|
||||||
required=True)
|
required=True)
|
||||||
|
|
||||||
@api.constrains('room_type_id')
|
# @api.constrains('room_type_id')
|
||||||
def _constrain_shared_room_type(self):
|
# def _constrain_shared_room_type(self):
|
||||||
for record in self:
|
# for record in self:
|
||||||
if record.shared_room_id:
|
# if record.shared_room_id:
|
||||||
if not record.room_type_id.shared_room:
|
# if not record.room_type_id.shared_room:
|
||||||
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 record.room_type_id.shared_room:
|
# if record.room_type_id.shared_room:
|
||||||
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.constrains('shared_room_id')
|
# @api.constrains('shared_room_id')
|
||||||
def _constrain_shared_room(self):
|
# def _constrain_shared_room(self):
|
||||||
for record in self:
|
# for record in self:
|
||||||
if record.shared_room_id:
|
# if record.shared_room_id:
|
||||||
if not record.capacity > 1:
|
# if not record.capacity > 1:
|
||||||
raise ValidationError(_('We cant save normal rooms \
|
# raise ValidationError(_('We cant save normal rooms \
|
||||||
in a shared room type'))
|
# in a shared room type'))
|
||||||
|
|
||||||
@api.constrains('capacity')
|
# @api.constrains('capacity')
|
||||||
def _check_capacity(self):
|
# def _check_capacity(self):
|
||||||
for record in self:
|
# for record in self:
|
||||||
if record.shared_room_id and record.capacity != 1:
|
# if record.shared_room_id and record.capacity != 1:
|
||||||
raise ValidationError(_("A Bed only can has capacity one"))
|
# raise ValidationError(_("A Bed only can has capacity one"))
|
||||||
if record.capacity < 1:
|
# if record.capacity < 1:
|
||||||
raise ValidationError(_("Room capacity can't be less than one"))
|
# raise ValidationError(_("Room capacity can't be less than one"))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def get_capacity(self, extra_bed=0):
|
def get_capacity(self, extra_bed=0):
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class HotelSharedRoom(models.Model):
|
|||||||
bed.update({'active': True})
|
bed.update({'active': True})
|
||||||
inactive_beds -= bed
|
inactive_beds -= bed
|
||||||
continue
|
continue
|
||||||
name = u'%s (%s)' % (self.name, i)
|
name = u'%s (%s)' % (self.name, i + 1)
|
||||||
bed_vals = {
|
bed_vals = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'max_adult': 1,
|
'max_adult': 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user