diff --git a/hotel/models/hotel_checkin_partner.py b/hotel/models/hotel_checkin_partner.py index 18797da05..fa03d943b 100644 --- a/hotel/models/hotel_checkin_partner.py +++ b/hotel/models/hotel_checkin_partner.py @@ -152,6 +152,19 @@ class HotelCheckinPartner(models.Model): record.update(vals) if record.reservation_id.state == 'confirm': record.reservation_id.state = 'booking' + if record.reservation_id.splitted: + master_reservation = record.reservation_id.parent_reservation or record.reservation_id + splitted_reservs = self.env['hotel.reservation'].search([ + ('splitted', '=', True), + '|', + ('parent_reservation', '=', master_reservation.id), + ('id', '=', master_reservation.id), + ('folio_id', '=', record.folio_id.id), + ('id', '!=', record.id), + ('state', '=', 'confirm') + ]) + if splitted_reservs: + splitted_reservs.update({'state': 'booking'}) return { "type": "ir.actions.do_nothing", } diff --git a/hotel/models/hotel_reservation.py b/hotel/models/hotel_reservation.py index 6873483c7..e386e0e8f 100644 --- a/hotel/models/hotel_reservation.py +++ b/hotel/models/hotel_reservation.py @@ -1224,6 +1224,19 @@ class HotelReservation(models.Model): if record.checkin_partner_ids: record.checkin_partner_ids.filtered( lambda check: check.state == 'booking').action_done() + if record.splitted: + master_reservation = record.parent_reservation or record + splitted_reservs = self.env['hotel.reservation'].search([ + ('splitted', '=', True), + '|', + ('parent_reservation', '=', master_reservation.id), + ('id', '=', master_reservation.id), + ('folio_id', '=', record.folio_id.id), + ('id', '!=', record.id), + ('state', 'not in', ('cancelled', 'done')) + ]) + if splitted_reservs: + splitted_reservs.update({'state': 'done'}) return True @api.multi