[IMP] Avoid splitted reservation in intemediate calculation room lines

This commit is contained in:
Dario Lodeiros
2021-07-12 12:16:37 +02:00
parent 678b2f404d
commit 60e82d576b
2 changed files with 4 additions and 2 deletions

View File

@@ -1123,7 +1123,7 @@ class PmsReservation(models.Model):
# REVIEW: Updating preferred_room_id here avoids cyclical dependency
for reservation in self:
room_ids = reservation.reservation_line_ids.mapped("room_id.id")
if len(room_ids) > 1:
if len(room_ids) > 1 and not self._context.get("not_split"):
reservation.splitted = True
reservation.preferred_room_id = False
else:

View File

@@ -199,7 +199,9 @@ class PmsReservationLine(models.Model):
manual_assigned = True
# if there is availability for the entire stay
if rooms_available:
# Avoid that reservation._compute_splitted set the
# reservation like splitted in intermediate calculations
reservation = reservation.with_context(not_split=True)
# if the reservation has a preferred room
if reservation.preferred_room_id: