[FIX] Longpolling messages

This commit is contained in:
Alexandre Díaz
2019-01-30 20:13:14 +01:00
parent 536a9f6cac
commit 36a0117840
3 changed files with 42 additions and 26 deletions

View File

@@ -15,3 +15,11 @@ class HotelFolio(models.Model):
for record in self: for record in self:
record.room_lines.send_bus_notification('write', 'noshow') record.room_lines.send_bus_notification('write', 'noshow')
return ret return ret
@api.multi
def compute_amount(self):
ret = super(HotelFolio, self).compute_amount()
with self.env.norecompute():
for record in self:
record.room_lines.send_bus_notification('write', 'noshow')
return ret

View File

@@ -827,9 +827,9 @@ var PMSCalendarController = AbstractController.extend({
var active_calendar = this._multi_calendar.get_active_calendar(); var active_calendar = this._multi_calendar.get_active_calendar();
var filterDates = active_calendar.getDates(); var filterDates = active_calendar.getDates();
var dfrom_fmt = filterDates[0].format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), var dfrom_fmt = filterDates[0].format(HotelConstants.ODOO_DATE_MOMENT_FORMAT),
dto_fmt = filterDates[1].format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), dto_fmt = filterDates[1].format(HotelConstants.ODOO_DATE_MOMENT_FORMAT),
now_fmt = moment().format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT); now_fmt = moment().format(HotelConstants.ODOO_DATE_MOMENT_FORMAT);
var domain_checkouts = [ var domain_checkouts = [
['checkout', '=', now_fmt], ['checkout', '=', now_fmt],

View File

@@ -59,9 +59,16 @@ var HotelCalendarView = AbstractRenderer.extend({
update_buttons_counter: function(ncheckouts, ncheckins, noverbookings, ncancelled) { update_buttons_counter: function(ncheckouts, ncheckins, noverbookings, ncancelled) {
var self = this; var self = this;
// Checkouts Button
var $ninfo = self.$el.find('#pms-menu #btn_action_checkout span.ninfo');
$ninfo.text(ncheckouts);
// Checkins Button
$ninfo = self.$el.find('#pms-menu #btn_action_checkin span.ninfo');
$ninfo.text(ncheckins);
// OverBookings // OverBookings
var $ninfo = self.$el.find('#pms-menu #btn_action_overbooking span.ninfo'); $ninfo = self.$el.find('#pms-menu #btn_action_overbooking span.ninfo');
$ninfo.text(noverbookings); $ninfo.text(noverbookings);
if (noverbookings) { if (noverbookings) {
$ninfo.parent().parent().addClass('overbooking-highlight'); $ninfo.parent().parent().addClass('overbooking-highlight');
@@ -69,14 +76,14 @@ var HotelCalendarView = AbstractRenderer.extend({
$ninfo.parent().parent().removeClass('overbooking-highlight'); $ninfo.parent().parent().removeClass('overbooking-highlight');
} }
// // Cancelled // Cancelled
// $ninfo = self.$el.find('#pms-menu #btn_action_cancelled span.ninfo'); $ninfo = self.$el.find('#pms-menu #btn_action_cancelled span.ninfo');
// $ninfo.text(ncancelled); $ninfo.text(ncancelled);
// if (ncancelled) { if (ncancelled) {
// $ninfo.parent().parent().addClass('cancelled-highlight'); $ninfo.parent().parent().addClass('cancelled-highlight');
// } else { } else {
// $ninfo.parent().parent().removeClass('cancelled-highlight'); $ninfo.parent().parent().removeClass('cancelled-highlight');
// } }
}, },
init_calendar_view: function(){ init_calendar_view: function(){
@@ -85,20 +92,20 @@ var HotelCalendarView = AbstractRenderer.extend({
/** VIEW CONTROLS INITIALIZATION **/ /** VIEW CONTROLS INITIALIZATION **/
// DATE TIME PICKERS // DATE TIME PICKERS
var DTPickerOptions = { var DTPickerOptions = {
viewMode: 'months', viewMode: 'months',
icons : { icons : {
time: 'fa fa-clock-o', time: 'fa fa-clock-o',
date: 'fa fa-calendar', date: 'fa fa-calendar',
up: 'fa fa-chevron-up', up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down' down: 'fa fa-chevron-down'
}, },
//language : moment.locale(), //language : moment.locale(),
locale : moment.locale(), locale : moment.locale(),
format : HotelConstants.L10N_DATE_MOMENT_FORMAT, format : HotelConstants.L10N_DATE_MOMENT_FORMAT,
widgetPositioning:{ widgetPositioning:{
horizontal: 'auto', horizontal: 'auto',
vertical: 'bottom' vertical: 'bottom'
} }
}; };
var $dateTimePickerBegin = this.$el.find('#pms-menu #date_begin'); var $dateTimePickerBegin = this.$el.find('#pms-menu #date_begin');
var $dateEndDays = this.$el.find('#pms-menu #date_end_days'); var $dateEndDays = this.$el.find('#pms-menu #date_end_days');
@@ -162,6 +169,7 @@ var HotelCalendarView = AbstractRenderer.extend({
}); });
return $.when( return $.when(
this.trigger_up('onUpdateButtonsCounter'),
this.trigger_up('onLoadViewFilters'), this.trigger_up('onLoadViewFilters'),
); );
}, },