mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] Wubook reservation modified
This commit is contained in:
@@ -866,9 +866,13 @@ class HotelReservation(models.Model):
|
||||
@api.multi
|
||||
def action_cancel(self):
|
||||
for record in self:
|
||||
cancel_reason = 'intime' if self._context.get("no_penalty", False) \
|
||||
else record.compute_cancelation_reason()
|
||||
if self._context.get("no_penalty", False):
|
||||
_logger.info("///MODIFIED RESERVATION - NO PENALTY")
|
||||
record.write({
|
||||
'state': 'cancelled',
|
||||
'cancelled_reason': record.compute_cancelation_reason()
|
||||
'cancelled_reason': cancel_reason
|
||||
})
|
||||
record._compute_cancelled_discount()
|
||||
if record.splitted:
|
||||
|
||||
@@ -306,6 +306,7 @@ class HotelReservationImporter(Component):
|
||||
rcode = str(book['reservation_code'])
|
||||
crcode = str(book['channel_reservation_code']) \
|
||||
if book['channel_reservation_code'] else 'undefined'
|
||||
rcode_modified = str(book['reservation_code'])
|
||||
|
||||
# Can't process failed reservations
|
||||
# (for example set a invalid new reservation and receive in
|
||||
@@ -336,6 +337,21 @@ class HotelReservationImporter(Component):
|
||||
if reserv_bind:
|
||||
folio_id = reserv_bind.folio_id
|
||||
|
||||
if rcode_modified:
|
||||
if book['was_modified'] and rcode in book['modified_reservations']:
|
||||
continue
|
||||
else:
|
||||
reservations = self.env['channel.hotel.reservation'].search([
|
||||
('external_id', 'in', book['modified_reservations']),
|
||||
('backend_id', '=', self.backend_record.id),
|
||||
('state', '!=', 'cancelled')
|
||||
])
|
||||
if reservations:
|
||||
reservations.with_context({
|
||||
'connector_no_export': True,
|
||||
'ota_limits': False,
|
||||
'no_penalty': True}).action_cancel()
|
||||
|
||||
# Need update reservations?
|
||||
reservs_processed = False
|
||||
reservs_binds = channel_reserv_obj.search([
|
||||
|
||||
Reference in New Issue
Block a user