[FIX]pms: force reservation flush in checkin partner create to make sure adults compute

This commit is contained in:
Darío Lodeiros
2022-04-23 11:18:26 +02:00
parent 9beaac3a49
commit ba8268c727

View File

@@ -688,6 +688,10 @@ class PmsCheckinPartner(models.Model):
raise ValidationError(
_("Is mandatory indicate the reservation on the checkin")
)
# If a checkin is manually created, we need make sure that
# the reservation adults are computed
if not reservation.checkin_partner_ids:
reservation.flush()
draft_checkins = reservation.checkin_partner_ids.filtered(
lambda c: c.state == "draft"
)