[FIX] Longpolling messages

This commit is contained in:
Alexandre Díaz
2019-01-30 19:27:40 +01:00
parent 9a4960c394
commit 536a9f6cac
2 changed files with 11 additions and 10 deletions

View File

@@ -1,8 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# Copyright 2018-2019 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import models, fields, api, _
_logger = logging.getLogger(__name__)
from odoo import models, api
class HotelFolio(models.Model):
@@ -11,7 +9,9 @@ class HotelFolio(models.Model):
@api.multi
def write(self, vals):
ret = super(HotelFolio, self).write(vals)
if vals.get('room_lines') or vals.get('service_lines'):
fields_to_check = ('room_lines', 'service_lines', 'pending_amount')
fields_checked = [elm for elm in fields_to_check if elm in vals]
if any(fields_checked):
for record in self:
record.room_lines.send_bus_notification('write', 'noshow')
return ret

View File

@@ -188,7 +188,7 @@ class HotelReservation(models.Model):
SELECT
hr.id, hr.room_id, hr.adults, hr.children, hr.checkin, hr.checkout, hr.reserve_color, hr.reserve_color_text,
hr.splitted, hr.parent_reservation, hr.overbooking, hr.state, hr.real_checkin, hr.real_checkout,
hr.out_service_description, hr.arrival_hour, hr.departure_hour, hr.channel_type,
hr.out_service_description, hr.arrival_hour, hr.departure_hour, hr.channel_type,
hr.price_room_services_set,
hf.id as folio_id, hf.name as folio_name, hf.reservation_type, hf.invoices_paid, hf.pending_amount,
@@ -196,11 +196,11 @@ class HotelReservation(models.Model):
rp.mobile, rp.phone, rp.email, rp.name as partner_name,
pt.name as room_type,
array_agg(pt2.name) FILTER (WHERE pt2.show_in_calendar = TRUE) as services,
rcr.name as closure_reason,
hbs.name as board_service_name
FROM hotel_reservation AS hr
LEFT JOIN hotel_folio AS hf ON hr.folio_id = hf.id
@@ -434,8 +434,9 @@ class HotelReservation(models.Model):
def send_bus_notification(self, naction, ntype, ntitle=''):
hotel_cal_obj = self.env['bus.hotel.calendar']
for record in self:
hotel_cal_obj.send_reservation_notification(
record.generate_bus_values(naction, ntype, ntitle))
if not isinstance(record.id, models.NewId):
hotel_cal_obj.send_reservation_notification(
record.generate_bus_values(naction, ntype, ntitle))
@api.model
def swap_reservations(self, fromReservsIds, toReservsIds):