[ADD] unconfirmed channel price

This commit is contained in:
Pablo
2019-02-22 18:46:28 +01:00
parent 39eba19b61
commit c6bc33bb32
3 changed files with 17 additions and 4 deletions

View File

@@ -133,6 +133,8 @@ class ChannelHotelReservation(models.Model):
class HotelReservation(models.Model):
_inherit = 'hotel.reservation'
unconfirmed_channel_price = fields.Boolean(related='folio_id.unconfirmed_channel_price')
@api.multi
def _set_access_for_channel_fields(self):
for record in self:

View File

@@ -19,6 +19,7 @@ class HotelFolio(models.Model):
has_channel_reservations = fields.Boolean(compute=_has_channel_reservations,
store=False,
old_name='whas_wubook_reservations')
unconfirmed_channel_price = fields.Boolean(default=False)
@job(default_channel='root.channel')
@api.model

View File

@@ -341,11 +341,21 @@ class HotelReservationImporter(Component):
checkout_utc_dt,
book,
)
#
if vals['price_unit'] != book['amount']:
self.create_issue(
section='reservation',
internal_message="Invalid reservation total price! %.2f (calculated) != %.2f (wubook)" % (vals['price_unit'], book['amount']),
channel_object_id=book['reservation_code'])
bs = self.env['hotel.board.service.room.type'].browse(vals['board_service_room_id'])
price_room_services_set = vals['price_unit'] + (bs.amount * len(broom['roomdays']))
vals.update({'unconfirmed_channel_price': True})
# check if difference is owing to misconfigured board services
if price_room_services_set != book['amount']:
internal_reason = 'Please, review the board services included in the reservation.'
self.create_issue(
section='reservation',
internal_message="Invalid reservation total price! %.2f (calculated) != %.2f (wubook) %s" % (
vals['price_unit'], book['amount'], internal_reason),
channel_object_id=book['reservation_code'])
# TODO: Add other reasons in case of need
free_rooms = room_type_bind.odoo_id.check_availability_room_type(
vals['checkin'],