mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms: fix _check_adults @ pms_reservation
This commit is contained in:
@@ -1426,13 +1426,13 @@ class PmsReservation(models.Model):
|
|||||||
@api.constrains("adults")
|
@api.constrains("adults")
|
||||||
def _check_adults(self):
|
def _check_adults(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
extra_bed = record.service_ids.filtered(
|
for line in record.reservation_line_ids:
|
||||||
lambda r: r.product_id.is_extra_bed is True
|
extra_beds = record.service_ids.service_line_ids.filtered(
|
||||||
)
|
lambda x: x.date == line.date and x.product_id.is_extra_bed is True
|
||||||
for room in record.reservation_line_ids.room_id:
|
)
|
||||||
if record.adults + record.children_occupying > room.get_capacity(
|
if (
|
||||||
sum(extra_bed.mapped("product_qty"))
|
record.adults + record.children_occupying
|
||||||
):
|
) > line.room_id.get_capacity(len(extra_beds)):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_(
|
_(
|
||||||
"Persons can't be higher than room capacity (%s)",
|
"Persons can't be higher than room capacity (%s)",
|
||||||
|
|||||||
Reference in New Issue
Block a user