mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[UPD] Task 973 - constrain for archive
This commit is contained in:
@@ -137,6 +137,14 @@ class HotelRoomType(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
record.capacity = record.get_capacity()
|
record.capacity = record.get_capacity()
|
||||||
|
|
||||||
|
@api.constrains('active')
|
||||||
|
def _check_active(self):
|
||||||
|
for record in self:
|
||||||
|
if not record.active and record.total_rooms_count > 0:
|
||||||
|
raise ValidationError(
|
||||||
|
_("You can not archive a room type with active rooms.") + " " +
|
||||||
|
_("Please, change the %s room(s) to other room type.") % str(record.total_rooms_count))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def get_restrictions(self, date, restriction_plan_id):
|
def get_restrictions(self, date, restriction_plan_id):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|||||||
Reference in New Issue
Block a user