diff --git a/hotel/models/hotel_room_type_restriction_item.py b/hotel/models/hotel_room_type_restriction_item.py index fd82480b5..8414b9947 100644 --- a/hotel/models/hotel_room_type_restriction_item.py +++ b/hotel/models/hotel_room_type_restriction_item.py @@ -31,7 +31,7 @@ class HotelRoomTypeRestrictionItem(models.Model): 'max_stay_arrival') def _check_min_stay(self): for record in self: - if record.self.min_stay < 0: + if record.min_stay < 0: raise ValidationError(_("Min. Stay can't be less than zero")) elif record.min_stay_arrival < 0: raise ValidationError( @@ -40,5 +40,4 @@ class HotelRoomTypeRestrictionItem(models.Model): raise ValidationError(_("Max. Stay can't be less than zero")) elif record.max_stay_arrival < 0: raise ValidationError( - ("Max. Stay Arrival can't be less than zero")) - + _("Max. Stay Arrival can't be less than zero")) diff --git a/hotel/wizard/wizard_reservation.py b/hotel/wizard/wizard_reservation.py index 6db0969ed..27f75d9c9 100644 --- a/hotel/wizard/wizard_reservation.py +++ b/hotel/wizard/wizard_reservation.py @@ -203,7 +203,7 @@ class FolioWizard(models.TransientModel): 'checkout': line.checkout, 'discount': line.discount, 'room_type_id': line.room_type_id.id, - 'to_read': line.to_read, #REFACT: wubook module + 'to_read': line.to_read, 'to_assign': line.to_assign, })) for line in self.service_wizard_ids: diff --git a/hotel_calendar/README.md b/hotel_calendar/README.md new file mode 100644 index 000000000..1e698fa0a --- /dev/null +++ b/hotel_calendar/README.md @@ -0,0 +1,14 @@ +HOTEL CALENDAR +============= +Calendars for manage reservations and revenue + +** UNDER DEVELOPMENT: NOT USE IN PRODUCTION ** + + +Credits +======= + +Creator +------------ + +* Alexandre Díaz diff --git a/hotel_calendar/data/menus.xml b/hotel_calendar/data/menus.xml index 72beee4bd..1c440156d 100644 --- a/hotel_calendar/data/menus.xml +++ b/hotel_calendar/data/menus.xml @@ -1,28 +1,28 @@ - - Hotel Calendar - hotel.reservation - pms - form - + + Hotel Calendar + hotel.reservation + pms + form + - - Hotel Calendar Management - hotel.calendar.management - mpms - + + Hotel Calendar Management + hotel.calendar.management + mpms + - + - + - + diff --git a/hotel_calendar/data/views.xml b/hotel_calendar/data/views.xml deleted file mode 100644 index 165508115..000000000 --- a/hotel_calendar/data/views.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - Hotel Calendar - hotel.reservation - - form - - -
-
-
-
- - - Hotel Calendar Management - hotel.calendar.management - form - -
-
-
- -
diff --git a/hotel_calendar/models/bus_hotel_calendar.py b/hotel_calendar/models/bus_hotel_calendar.py index 8928cce33..ff6af8279 100644 --- a/hotel_calendar/models/bus_hotel_calendar.py +++ b/hotel_calendar/models/bus_hotel_calendar.py @@ -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'], diff --git a/hotel_calendar/models/hotel_calendar_management.py b/hotel_calendar/models/hotel_calendar_management.py index 72c71f54d..2ee906533 100644 --- a/hotel_calendar/models/hotel_calendar_management.py +++ b/hotel_calendar/models/hotel_calendar_management.py @@ -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([ diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py index 9e4ce35e6..cb2baecc9 100644 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ b/hotel_calendar/models/inherited_hotel_reservation.py @@ -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, diff --git a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py index 48456fc0c..8e9f6b85e 100644 --- a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py +++ b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py @@ -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 diff --git a/hotel_calendar/readme/DESCRIPTION.rst b/hotel_calendar/readme/DESCRIPTION.rst index a7d8b5ff5..0c880ab0e 100644 --- a/hotel_calendar/readme/DESCRIPTION.rst +++ b/hotel_calendar/readme/DESCRIPTION.rst @@ -1,8 +1,8 @@ -This module adds new view type "pms" +This module adds new view type "pms" and "mpms" Features: * Responsive & Interactive PMS + * Booking Management * Revenue Management * Long-Polling Communication - diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js index 9706abd13..dcb1e8266 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js @@ -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) { diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js index f92c09774..9b59fb25f 100644 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js +++ b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js @@ -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', diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js index 131de33c5..17b33d88c 100644 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js +++ b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js @@ -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); }); }, diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_model.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_model.js index 409e3894d..bdbd9f358 100644 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_model.js +++ b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_model.js @@ -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', diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js index 81b7979a5..d1f7d0637 100644 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js +++ b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js @@ -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 : { diff --git a/hotel_calendar_channel_connector/README.md b/hotel_calendar_channel_connector/README.md new file mode 100644 index 000000000..a102d4230 --- /dev/null +++ b/hotel_calendar_channel_connector/README.md @@ -0,0 +1,12 @@ +HOTEL CALENDAR CHANNEL CONNECTOR +=================================== +Unify 'hotel_calendar' and 'hotel_channel_connector' + + +Credits +======= + +Creator +------------ + +* Alexandre Díaz diff --git a/hotel_calendar_channel_connector/README.rst b/hotel_calendar_channel_connector/README.rst deleted file mode 100644 index b855c9f79..000000000 --- a/hotel_calendar_channel_connector/README.rst +++ /dev/null @@ -1,15 +0,0 @@ -HOTEL CALENDAR WUBOOK -============= -- Show button for see reservations from wubook in hotel calendar view -- Mark as read-only reservations from wubook - -** UNDER DEVELOPMENT: NOT USE IN PRODUCTION ** - - -Credits -======= - -Creator ------------- - -* Alexandre Díaz \ No newline at end of file diff --git a/hotel_calendar_channel_connector/__manifest__.py b/hotel_calendar_channel_connector/__manifest__.py index 619129398..1045e0c2f 100644 --- a/hotel_calendar_channel_connector/__manifest__.py +++ b/hotel_calendar_channel_connector/__manifest__.py @@ -1,31 +1,12 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Solucións Aloxa S.L. -# Alexandre Díaz -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2018 Alexandre Díaz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Hotel Calendar Channel Connector', - 'version': '1.0', + 'version': '11.0.2.0', 'author': "Alexandre Díaz ", 'website': 'https://github.com/hootel/hootel', - 'category': 'eiqui/hotel', + 'category': 'hotel/addon', 'summary': "Hotel Calendar Channel Connector", 'description': "Unify 'hotel_calendar' and 'hotel_channel_connector'", 'depends': [ @@ -46,7 +27,7 @@ 'test': [ ], - 'installable': False, + 'installable': True, 'auto_install': True, 'application': False, 'license': 'AGPL-3', diff --git a/hotel_calendar_channel_connector/models/__init__.py b/hotel_calendar_channel_connector/models/__init__.py index 4cb563145..d04b2babc 100644 --- a/hotel_calendar_channel_connector/models/__init__.py +++ b/hotel_calendar_channel_connector/models/__init__.py @@ -2,5 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import inherited_hotel_reservation from . import inherited_bus_hotel_calendar -from . import inherited_hotel_channel_connector_issue from . import inherited_hotel_calendar_management diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py b/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py index 28eeab040..6f90ab6ea 100644 --- a/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py +++ b/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py @@ -34,5 +34,5 @@ class HotelCalendarManagement(models.TransientModel): pricelist, restrictions, availability) - self.env['wubook'].push_changes() + self.env['channel.backend'].cron_push_changes() return res diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_channel_connector_issue.py b/hotel_calendar_channel_connector/models/inherited_hotel_channel_connector_issue.py deleted file mode 100644 index 37be839a6..000000000 --- a/hotel_calendar_channel_connector/models/inherited_hotel_channel_connector_issue.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields, api, _ - - -class HotelChannelConnectorIssue(models.Model): - _inherit = 'hotel.channel.connector.issue' - - @api.model - def create(self, vals): - issue_id = super(HotelChannelConnectorIssue, self).create(vals) - self.env['bus.hotel.calendar'].send_issue_notification( - 'warn', - _("Oops! Issue Reported!!"), - issue_id.id, - issue_id.section, - issue_id.message) - return issue_id diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py b/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py index fd7435e58..fd211b699 100644 --- a/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py +++ b/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py @@ -43,7 +43,7 @@ class HotelReservation(models.Model): for v_rval in vals[0]: reserv = hotel_reservation_obj.browse(v_rval[1]) json_reservations.append(( - reserv.product_id.id, + reserv.room_id.id, reserv.id, reserv.folio_id.partner_id.name, reserv.adults, @@ -78,7 +78,7 @@ class HotelReservation(models.Model): 'action': naction, 'type': ntype, 'title': ntitle, - 'product_id': record.product_id.id, + 'room_id': record.room_id.id, 'reserv_id': record.id, 'partner_name': record.partner_id.name, 'adults': record.adults, @@ -91,7 +91,7 @@ class HotelReservation(models.Model): 'splitted': record.splitted, 'parent_reservation': record.parent_reservation and record.parent_reservation.id or 0, - 'room_name': record.product_id.name, + 'room_name': record.room_id.name, 'partner_phone': record.partner_id.mobile or record.partner_id.phone or _('Undefined'), 'state': record.state, diff --git a/hotel_calendar_channel_connector/readme/CONTRIBUTORS.rst b/hotel_calendar_channel_connector/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..55873688c --- /dev/null +++ b/hotel_calendar_channel_connector/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Alexandre Díaz diff --git a/hotel_calendar_channel_connector/readme/DESCRIPTION.rst b/hotel_calendar_channel_connector/readme/DESCRIPTION.rst new file mode 100644 index 000000000..10d829e13 --- /dev/null +++ b/hotel_calendar_channel_connector/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +This module unify 'hotel_calendar' and 'hotel_channel_connector' + +Features: + + * Add 'cloud' button on calendar + * Adds restrictions to reservation management + * Call connector diff --git a/hotel_calendar_channel_connector/readme/ROADMAP.rst b/hotel_calendar_channel_connector/readme/ROADMAP.rst new file mode 100644 index 000000000..e69de29bb diff --git a/hotel_calendar_channel_connector/readme/USAGE.rst b/hotel_calendar_channel_connector/readme/USAGE.rst new file mode 100644 index 000000000..ede695e0e --- /dev/null +++ b/hotel_calendar_channel_connector/readme/USAGE.rst @@ -0,0 +1 @@ +No configuration required diff --git a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_controller.js b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_controller.js index d242eec9f..da3f84e30 100644 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_controller.js +++ b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_controller.js @@ -66,7 +66,7 @@ var PMSHotelCalendarControllerChannelConnector = PMSCalendarController.include({ } else if (notif[1]['type'] === 'reservation') { var reserv = notif[1]['reservation']; - if (reserv['wrid']) { + if (reserv['external_id']) { if (notif[1]['action'] === 'create') { this._play_sound(this.SOUNDS.BOOK_NEW); } else if (notif[1]['action'] !== 'unlink' && reserv['state'] === 'cancelled') { diff --git a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_renderer.js b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_renderer.js index a0c12dd1b..87e511f3a 100644 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_renderer.js +++ b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_renderer.js @@ -37,7 +37,7 @@ odoo.define('hotel_calendar_channel_connector.PMSHotelCalendarRendererChannelCon var self = this; return this._super().then(function () { self.$el.find('#btn_channel_manager_request').on('click', function (ev) { - self.do_action("hotel_calendar_wubook.hotel_reservation_action_manager_request"); + self.do_action("hotel_calendar_channel_connector.hotel_reservation_action_manager_request"); }); }); }, @@ -51,7 +51,7 @@ odoo.define('hotel_calendar_channel_connector.PMSHotelCalendarRendererChannelCon _generate_bookings_domain: function(tsearch) { var domain = this._super(tsearch); domain.splice(0, 0, '|'); - domain.push(['wrid', 'ilike', tsearch]); + domain.push(['external_id', 'ilike', tsearch]); return domain; } }); diff --git a/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml b/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml index b395cbf06..776e273d7 100644 --- a/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml +++ b/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml @@ -20,8 +20,8 @@ - -
  • Channel:
  • + +
  • Channel:
  • diff --git a/hotel_calendar_channel_connector/views/actions.xml b/hotel_calendar_channel_connector/views/actions.xml index fb0f0eb07..2b73cce32 100644 --- a/hotel_calendar_channel_connector/views/actions.xml +++ b/hotel_calendar_channel_connector/views/actions.xml @@ -3,10 +3,10 @@ - Reservations to Assign from WuBook + Reservations to Assign from Channel hotel.reservation tree,form - + [('to_assign','=',True),('to_read','=',True)] diff --git a/hotel_calendar_channel_connector/views/hotel_reservation.xml b/hotel_calendar_channel_connector/views/hotel_reservation.xml index 42011bdef..13cf82c6b 100644 --- a/hotel_calendar_channel_connector/views/hotel_reservation.xml +++ b/hotel_calendar_channel_connector/views/hotel_reservation.xml @@ -11,7 +11,7 @@ decoration-muted="state == 'cancelled' and not overbooking" decoration-warning="overbooking" > -