mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Checkint and Checkout process on splitted reservations
This commit is contained in:
@@ -152,6 +152,19 @@ class HotelCheckinPartner(models.Model):
|
|||||||
record.update(vals)
|
record.update(vals)
|
||||||
if record.reservation_id.state == 'confirm':
|
if record.reservation_id.state == 'confirm':
|
||||||
record.reservation_id.state = 'booking'
|
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 {
|
return {
|
||||||
"type": "ir.actions.do_nothing",
|
"type": "ir.actions.do_nothing",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1224,6 +1224,19 @@ class HotelReservation(models.Model):
|
|||||||
if record.checkin_partner_ids:
|
if record.checkin_partner_ids:
|
||||||
record.checkin_partner_ids.filtered(
|
record.checkin_partner_ids.filtered(
|
||||||
lambda check: check.state == 'booking').action_done()
|
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
|
return True
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
Reference in New Issue
Block a user