mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Finalize Calendar & Connector integration (#69)
* [WIP] Refactor calendar_channel_connector * [FIX] Hotel Calendar + Hotel Connector * [ADD] Push URLs * [IMP] Connector * [IMP] Notifications * [ADD] hotel_channel_connector_wubook * [FIX] missing imports * [IMP] Clean code
This commit is contained in:
@@ -39,7 +39,7 @@ class BusHotelCalendar(models.TransientModel):
|
||||
'username': user_id.partner_id.name,
|
||||
'userid': user_id.id,
|
||||
'reservation': {
|
||||
'id': vals['id'],
|
||||
'room_id': vals['room_id'],
|
||||
'reserv_id': vals['reserv_id'],
|
||||
'partner_name': vals['partner_name'],
|
||||
'adults': vals['adults'],
|
||||
@@ -89,7 +89,7 @@ class BusHotelCalendar(models.TransientModel):
|
||||
return {
|
||||
'type': 'restriction',
|
||||
'restriction': {
|
||||
vals['room_id']: {
|
||||
vals['room_type_id']: {
|
||||
date_dt.strftime("%d/%m/%Y"): [
|
||||
vals['min_stay'],
|
||||
vals['min_stay_arrival'],
|
||||
|
||||
@@ -85,7 +85,6 @@ class HotelCalendarManagement(models.TransientModel):
|
||||
res_id = room_type_rest_item_obj.search([
|
||||
('date', '=', restriction['date']),
|
||||
('restriction_id', '=', int(restriction_id)),
|
||||
('applied_on', '=', '0_room_type'),
|
||||
('room_type_id', '=', int(k_res)),
|
||||
], limit=1)
|
||||
vals = self._get_restrictions_values(restriction)
|
||||
@@ -93,7 +92,6 @@ class HotelCalendarManagement(models.TransientModel):
|
||||
vals.update({
|
||||
'date': restriction['date'],
|
||||
'restriction_id': int(restriction_id),
|
||||
'applied_on': '0_room_type',
|
||||
'room_type_id': int(k_res),
|
||||
})
|
||||
res_id = room_type_rest_item_obj.create(vals)
|
||||
@@ -277,7 +275,6 @@ class HotelCalendarManagement(models.TransientModel):
|
||||
restriction_item_ids = room_type_rest_it_obj.search([
|
||||
('date', '>=', dfrom), ('date', '<=', dto),
|
||||
('restriction_id', '=', restriction_id),
|
||||
('applied_on', '=', '0_room_type'),
|
||||
])
|
||||
|
||||
pricelist_item_ids = self.env['product.pricelist.item'].search([
|
||||
|
||||
@@ -175,7 +175,7 @@ class HotelReservation(models.Model):
|
||||
ndate_str = ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
rest_id = room_type_rest_obj.search([
|
||||
('room_type_id', '=', room_type.id),
|
||||
('date', '>=', ndate_str),
|
||||
('date', '=', ndate_str),
|
||||
('restriction_id', '=', restriction_id)
|
||||
], limit=1)
|
||||
if rest_id and (rest_id.min_stay or rest_id.min_stay_arrival or
|
||||
@@ -267,7 +267,7 @@ class HotelReservation(models.Model):
|
||||
'action': naction,
|
||||
'type': ntype,
|
||||
'title': ntitle,
|
||||
'id': record.room_id.id,
|
||||
'room_id': record.room_id.id,
|
||||
'reserv_id': record.id,
|
||||
'partner_name': record.partner_id.name,
|
||||
'adults': record.adults,
|
||||
@@ -280,7 +280,7 @@ class HotelReservation(models.Model):
|
||||
'splitted': record.splitted,
|
||||
'parent_reservation': record.parent_reservation and
|
||||
record.parent_reservation.id or 0,
|
||||
'room_name': record.name,
|
||||
'room_name': record.room_id.name,
|
||||
'partner_phone': record.partner_id.mobile
|
||||
or record.partner_id.phone or _('Undefined'),
|
||||
'state': record.state,
|
||||
|
||||
@@ -15,21 +15,19 @@ class HotelRoomTypeResrtrictionItem(models.Model):
|
||||
'res.config.settings', 'default_restriction_id')
|
||||
if restrictions_default_id:
|
||||
restrictions_default_id = int(restrictions_default_id)
|
||||
restriction_id = res.restriction_id.id
|
||||
if restriction_id == restrictions_default_id and \
|
||||
self.applied_on == '0_room_type':
|
||||
if res.restriction_id.id == restrictions_default_id:
|
||||
self.env['bus.hotel.calendar'].send_restriction_notification({
|
||||
'restriction_id': self.restriction_id.id,
|
||||
'date': self.date,
|
||||
'min_stay': self.min_stay,
|
||||
'min_stay_arrival': self.min_stay_arrival,
|
||||
'max_stay': self.max_stay,
|
||||
'max_stay_arrival': self.max_stay_arrival,
|
||||
'closed': self.closed,
|
||||
'closed_departure': self.closed_departure,
|
||||
'closed_arrival': self.closed_arrival,
|
||||
'room_type_id': self.room_type_id.id,
|
||||
'id': self.id,
|
||||
'restriction_id': res.restriction_id.id,
|
||||
'date': res.date,
|
||||
'min_stay': res.min_stay,
|
||||
'min_stay_arrival': res.min_stay_arrival,
|
||||
'max_stay': res.max_stay,
|
||||
'max_stay_arrival': res.max_stay_arrival,
|
||||
'closed': res.closed,
|
||||
'closed_departure': res.closed_departure,
|
||||
'closed_arrival': res.closed_arrival,
|
||||
'room_type_id': res.room_type_id.id,
|
||||
'id': res.id,
|
||||
})
|
||||
return res
|
||||
|
||||
|
||||
@@ -281,10 +281,10 @@ var PMSCalendarController = AbstractController.extend({
|
||||
nreservs = _.reject(nreservs, function(item){ return item.id == reserv['reserv_id']; });
|
||||
} else {
|
||||
nreservs = _.reject(nreservs, {'id': reserv['reserv_id']}); // Only like last changes
|
||||
var room = this.renderer._hcalendar.getRoom(reserv['id'], reserv['overbooking'], reserv['reserv_id']);
|
||||
var room = this.renderer._hcalendar.getRoom(reserv['room_id'], reserv['overbooking'], reserv['reserv_id']);
|
||||
// need create a overbooking row?
|
||||
if (!room && reserv['overbooking']) {
|
||||
room = this.renderer._hcalendar.createOBRoom(this.renderer._hcalendar.getRoom(reserv['id']), reserv['reserv_id']);
|
||||
room = this.renderer._hcalendar.createOBRoom(this.renderer._hcalendar.getRoom(reserv['room_id']), reserv['reserv_id']);
|
||||
this.renderer._hcalendar.createOBRoomRow(room);
|
||||
}
|
||||
if (!room) {
|
||||
|
||||
@@ -116,6 +116,7 @@ return AbstractModel.extend({
|
||||
},
|
||||
|
||||
save_changes: function(params) {
|
||||
params.splice(0, 0, false); // FIXME: ID=False because first parameter its an integer
|
||||
return this._rpc({
|
||||
model: 'hotel.calendar.management',
|
||||
method: 'save_changes',
|
||||
|
||||
@@ -115,7 +115,6 @@ var MPMSCalendarController = AbstractController.extend({
|
||||
_onLoadCalendarSettings: function (ev) {
|
||||
var self = this;
|
||||
this.model.get_hcalendar_settings().then(function(results){
|
||||
console.log(results);
|
||||
self.renderer.setHCalendarSettings(results);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -21,6 +21,7 @@ return AbstractModel.extend({
|
||||
},
|
||||
|
||||
save_changes: function (params) {
|
||||
params.splice(0, 0, false); // FIXME: ID=False because first parameter its an integer
|
||||
return this._rpc({
|
||||
model: this.modelName,
|
||||
method: 'save_changes',
|
||||
|
||||
@@ -81,11 +81,7 @@ var HotelCalendarManagementView = AbstractRenderer.extend({
|
||||
var availability = this._hcalendar.getAvailability(true);
|
||||
|
||||
var params = this.generate_params();
|
||||
console.log("---- PARAMS");
|
||||
console.log(params);
|
||||
var oparams = [params['prices'], params['restrictions'], pricelist, restrictions, availability];
|
||||
console.log("---- OPARAMS");
|
||||
console.log(oparams);
|
||||
this.trigger_up('onSaveChanges', oparams);
|
||||
},
|
||||
|
||||
@@ -240,7 +236,6 @@ var HotelCalendarManagementView = AbstractRenderer.extend({
|
||||
|
||||
/** VIEW CONTROLS INITIALIZATION **/
|
||||
// DATE TIME PICKERS
|
||||
console.log("asdads");
|
||||
var DTPickerOptions = {
|
||||
viewMode: 'months',
|
||||
icons : {
|
||||
|
||||
Reference in New Issue
Block a user