mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] unconfirmed channel price
This commit is contained in:
@@ -133,6 +133,8 @@ class ChannelHotelReservation(models.Model):
|
|||||||
class HotelReservation(models.Model):
|
class HotelReservation(models.Model):
|
||||||
_inherit = 'hotel.reservation'
|
_inherit = 'hotel.reservation'
|
||||||
|
|
||||||
|
unconfirmed_channel_price = fields.Boolean(related='folio_id.unconfirmed_channel_price')
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _set_access_for_channel_fields(self):
|
def _set_access_for_channel_fields(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class HotelFolio(models.Model):
|
|||||||
has_channel_reservations = fields.Boolean(compute=_has_channel_reservations,
|
has_channel_reservations = fields.Boolean(compute=_has_channel_reservations,
|
||||||
store=False,
|
store=False,
|
||||||
old_name='whas_wubook_reservations')
|
old_name='whas_wubook_reservations')
|
||||||
|
unconfirmed_channel_price = fields.Boolean(default=False)
|
||||||
|
|
||||||
@job(default_channel='root.channel')
|
@job(default_channel='root.channel')
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
@@ -341,11 +341,21 @@ class HotelReservationImporter(Component):
|
|||||||
checkout_utc_dt,
|
checkout_utc_dt,
|
||||||
book,
|
book,
|
||||||
)
|
)
|
||||||
|
#
|
||||||
if vals['price_unit'] != book['amount']:
|
if vals['price_unit'] != book['amount']:
|
||||||
self.create_issue(
|
bs = self.env['hotel.board.service.room.type'].browse(vals['board_service_room_id'])
|
||||||
section='reservation',
|
price_room_services_set = vals['price_unit'] + (bs.amount * len(broom['roomdays']))
|
||||||
internal_message="Invalid reservation total price! %.2f (calculated) != %.2f (wubook)" % (vals['price_unit'], book['amount']),
|
vals.update({'unconfirmed_channel_price': True})
|
||||||
channel_object_id=book['reservation_code'])
|
# 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(
|
free_rooms = room_type_bind.odoo_id.check_availability_room_type(
|
||||||
vals['checkin'],
|
vals['checkin'],
|
||||||
|
|||||||
Reference in New Issue
Block a user