diff --git a/call_center_report/README.rst b/call_center_report/README.rst deleted file mode 100644 index ec06d16ac..000000000 --- a/call_center_report/README.rst +++ /dev/null @@ -1,6 +0,0 @@ -CALL CENTER REPORT -============= - -Export call center report in xls format - - diff --git a/call_center_report/__init__.py b/call_center_report/__init__.py deleted file mode 100644 index 351d1ee57..000000000 --- a/call_center_report/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import wizard diff --git a/call_center_report/__manifest__.py b/call_center_report/__manifest__.py deleted file mode 100644 index 8204bbb7e..000000000 --- a/call_center_report/__manifest__.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## - -{ - 'name': 'Call Center Report', - 'version': '1.0', - 'author': "Dario Lodeiros", - 'website': 'https://www.eiqui.com', - 'category': 'reports', - 'summary': "Export services and reservation report in xls format", - 'description': "Call Center Report", - 'depends': [ - 'hotel', - ], - 'external_dependencies': { - 'python': ['xlsxwriter'] - }, - 'data': [ - 'wizard/call_center_report.xml', - 'data/menus.xml', - ], - 'qweb': [], - 'test': [ - ], - - 'installable': True, - 'auto_install': False, - 'application': False, - 'license': 'AGPL-3', -} diff --git a/call_center_report/data/menus.xml b/call_center_report/data/menus.xml deleted file mode 100644 index d48c886eb..000000000 --- a/call_center_report/data/menus.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/call_center_report/i18n/es.po b/call_center_report/i18n/es.po deleted file mode 100644 index 0f9b0fa66..000000000 --- a/call_center_report/i18n/es.po +++ /dev/null @@ -1,171 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * cash_daily_report -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-20 07:33+0000\n" -"PO-Revision-Date: 2018-05-20 09:34+0200\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"Language: es\n" -"X-Generator: Poedit 1.8.7.1\n" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:85 -#, python-format -msgid "Amount" -msgstr "Importe" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:78 -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -#, python-format -msgid "Cash Daily Report" -msgstr "Informe de caja" - -#. module: cash_daily_report -#: model:ir.actions.act_window,name:cash_daily_report.action_open_cash_daily_report_wizard -#: model:ir.ui.menu,name:cash_daily_report.cash_daily_report_wizard -msgid "Cash Daily Report Wizard" -msgstr "Informe de caja diaria" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:82 -#, python-format -msgid "Client" -msgstr "Cliente" - -#. module: cash_daily_report -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -msgid "Close" -msgstr "Cerrar" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_uid -msgid "Created by" -msgstr "Creado por" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_date -msgid "Created on" -msgstr "Creado en" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:83 -#, python-format -msgid "Date" -msgstr "Fecha" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_display_name -msgid "Display Name" -msgstr "Mostrar Nombre" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_end -msgid "End Date" -msgstr "Fecha finalización" - -#. module: cash_daily_report -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -msgid "Generate XLS" -msgstr "Generar XLS" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_id -msgid "ID" -msgstr "ID" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:84 -#, python-format -msgid "Journal" -msgstr "Diario" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard___last_update -msgid "Last Modified on" -msgstr "Última modificación en" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_uid -msgid "Last Updated by" -msgstr "Última actualización por" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_date -msgid "Last Updated on" -msgstr "Última actualización en" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:80 -#, python-format -msgid "Name" -msgstr "Nombre" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:128 -#, python-format -msgid "Not Any Payments" -msgstr "No hay movimientos" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:81 -#, python-format -msgid "Reference" -msgstr "Referencia" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_start -msgid "Start Date" -msgstr "Fecha de inicio" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:143 -#, python-format -msgid "TOTAL" -msgstr "TOTAL" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:139 -#, python-format -msgid "TOTAL PAYMENT RETURNS" -msgstr "TOTAL DEVOLUCIONES" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:134 -#, python-format -msgid "TOTAL PAYMENTS" -msgstr "TOTAL PAGOS" - -#. module: cash_daily_report -#: model:ir.ui.menu,name:cash_daily_report.menu_account_finance_xls_reports -msgid "XLS Reports" -msgstr "XLS Reports" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_binary -msgid "Xls binary" -msgstr "Xls archivo" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_filename -msgid "Xls filename" -msgstr "Xls nombre de archivo" - -#. module: cash_daily_report -#: model:ir.model,name:cash_daily_report.model_cash_daily_report_wizard -msgid "cash.daily.report.wizard" -msgstr "cash.daily.report.wizard" - -#. module: cash_daily_report -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -msgid "or" -msgstr "o" diff --git a/call_center_report/wizard/__init__.py b/call_center_report/wizard/__init__.py deleted file mode 100644 index f3c151d2d..000000000 --- a/call_center_report/wizard/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import call_center_report diff --git a/call_center_report/wizard/call_center_report.py b/call_center_report/wizard/call_center_report.py deleted file mode 100644 index 114aee314..000000000 --- a/call_center_report/wizard/call_center_report.py +++ /dev/null @@ -1,348 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from io import BytesIO -from datetime import datetime, date -import xlsxwriter -import base64 -from odoo import api, fields, models, _ -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT - - -class CallCenterReportWizard(models.TransientModel): - _name = 'call.center.report.wizard' - - @api.model - def _get_default_date_start(self): - return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT) - - @api.model - def _get_default_date_end(self): - return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT) - - date_start = fields.Date("Start Date", default=_get_default_date_start) - date_end = fields.Date("End Date", default=_get_default_date_end) - xls_filename = fields.Char() - xls_binary = fields.Binary() - - @api.model - def _export(self): - date_format = "%d-%m-%Y" - time_format = "%H:%M" - file_data = BytesIO() - workbook = xlsxwriter.Workbook(file_data, { - 'strings_to_numbers': True, - 'default_date_format': 'dd/mm/yyyy' - }) - - company_id = self.env.user.company_id - workbook.set_properties({ - 'title': 'Exported data from ' + company_id.name, - 'subject': 'Payments Data from Odoo of ' + company_id.name, - 'author': 'Odoo', - 'manager': u'Call Center', - 'company': company_id.name, - 'category': 'Hoja de Calculo', - 'keywords': 'payments, odoo, data, ' + company_id.name, - 'comments': 'Created with Python in Odoo and XlsxWriter'}) - workbook.use_zip64() - - xls_cell_format_date = workbook.add_format({ - 'num_format': 'dd/mm/yyyy' - }) - xls_cell_format_money = workbook.add_format({ - 'num_format': '#,##0.00' - }) - xls_cell_format_header = workbook.add_format({ - 'bg_color': '#CCCCCC' - }) - - worksheet = workbook.add_worksheet(_('Call Center Report - Production')) - - worksheet.write('A1', _('Ficha'), xls_cell_format_header) - worksheet.write('B1', _('Fecha de Pedido'), xls_cell_format_header) - worksheet.write('C1', _('Cliente'), xls_cell_format_header) - worksheet.write('D1', _('Producto'), xls_cell_format_header) - worksheet.write('E1', _('Noches/Uds'), xls_cell_format_header) - worksheet.write('F1', _('Adultos'), xls_cell_format_header) - worksheet.write('G1', _('Checkin'), xls_cell_format_header) - worksheet.write('H1', _('In-Hora'), xls_cell_format_header) - worksheet.write('I1', _('Checkout'), xls_cell_format_header) - worksheet.write('J1', _('Creado por'), xls_cell_format_header) - worksheet.write('K1', _('Total'), xls_cell_format_header) - - worksheet.set_column('B:B', 20) - worksheet.set_column('C:C', 20) - worksheet.set_column('D:D', 20) - worksheet.set_column('E:E', 20) - worksheet.set_column('F:F', 13) - - reservations_obj = self.env['hotel.reservation'] - reservations = reservations_obj.search([ - ('checkin', '>=', self.date_start), - ('checkout', '<=', self.date_end), - ('state', '=', 'done'), - ('channel_type', '=', 'call'), - ('folio_id.pending_amount', '<', 1), - ]) - offset = 1 - total_reservation_amount = 0.0 - for k_res, v_res in enumerate(reservations): - checkin_date = datetime.strptime(v_res.checkin, DEFAULT_SERVER_DATE_FORMAT) - checkout_date = datetime.strptime(v_res.checkout, DEFAULT_SERVER_DATE_FORMAT) - worksheet.write(k_res+offset, 0, v_res.folio_id.name) - worksheet.write(k_res+offset, 1, v_res.folio_id.date_order, - xls_cell_format_date) - worksheet.write(k_res+offset, 2, v_res.partner_id.name) - worksheet.write(k_res+offset, 3, v_res.room_type_id.name) - worksheet.write(k_res+offset, 4, v_res.nights) - worksheet.write(k_res+offset, 5, v_res.adults) - worksheet.write(k_res+offset, 6, checkin_date.strftime(date_format), - xls_cell_format_date) - worksheet.write(k_res+offset, 7, v_res.arrival_hour) - worksheet.write(k_res+offset, 8, checkout_date.strftime(date_format), - xls_cell_format_date) - worksheet.write(k_res+offset, 9, v_res.create_uid.name) - worksheet.write(k_res+offset, 10, v_res.price_total, - xls_cell_format_money) - total_reservation_amount += v_res.price_total - - folio_ids = reservations.mapped('folio_id.id') - folios = self.env['hotel.folio'].browse(folio_ids) - services = self.env['hotel.service'].browse() - for folio in folios: - services += folio.service_ids.filtered(lambda r: - r.channel_type == 'call' and r.folio_id.pending_amount < 1) - offset += len(reservations) - total_service_amount = k_line = 0.0 - for k_service, v_service in enumerate(services): - worksheet.write(k_service+offset, 0, v_service.folio_id.name) - worksheet.write(k_service+offset, 1, v_service.folio_id.date_order, - xls_cell_format_date) - worksheet.write(k_service+offset, 2, v_service.folio_id.partner_id.name) - worksheet.write(k_service+offset, 3, v_service.product_id.name) - worksheet.write(k_service+offset, 4, v_service.product_qty) - worksheet.write(k_service+offset, 5, '') - worksheet.write(k_service+offset, 6, '') - worksheet.write(k_service+offset, 7, '') - worksheet.write(k_service+offset, 8, '') - worksheet.write(k_service+offset, 9, v_service .create_uid.name) - worksheet.write(k_service+offset, 10, v_service.price_total, - xls_cell_format_money) - total_service_amount += v_service.price_total - offset += len(services) - #~ if total_reservation_amount == 0 and total_service_amount == 0: - #~ raise UserError(_('No Hay reservas de Call Center')) - line = offset - if k_line: - line = k_line + offset - if total_reservation_amount > 0: - line += 1 - worksheet.write(line, 9, _('TOTAL RESERVAS')) - worksheet.write(line, 10, total_reservation_amount, - xls_cell_format_money) - if total_service_amount > 0: - line += 1 - worksheet.write(line, 9, _('TOTAL SERVICIOS')) - worksheet.write(line, 10, total_service_amount, - xls_cell_format_money) - line += 1 - worksheet.write(line, 9, _('TOTAL')) - worksheet.write(line, 10 , total_reservation_amount + total_service_amount, - xls_cell_format_money) - - worksheet = workbook.add_worksheet(_('Call Center Report - Sales')) - - worksheet.write('A1', _('Estado'), xls_cell_format_header) - worksheet.write('B1', _('Ficha'), xls_cell_format_header) - worksheet.write('C1', _('Fecha de Pedido'), xls_cell_format_header) - worksheet.write('D1', _('Cliente'), xls_cell_format_header) - worksheet.write('E1', _('Producto'), xls_cell_format_header) - worksheet.write('F1', _('Noches/Uds'), xls_cell_format_header) - worksheet.write('G1', _('Adultos'), xls_cell_format_header) - worksheet.write('H1', _('Checkin'), xls_cell_format_header) - worksheet.write('I1', _('In-Hora'), xls_cell_format_header) - worksheet.write('J1', _('Checkout'), xls_cell_format_header) - worksheet.write('K1', _('Creado por'), xls_cell_format_header) - worksheet.write('L1', _('Total'), xls_cell_format_header) - - worksheet.set_column('B:B', 20) - worksheet.set_column('C:C', 20) - worksheet.set_column('D:D', 20) - worksheet.set_column('E:E', 20) - worksheet.set_column('F:F', 13) - - reservations_obj = self.env['hotel.reservation'] - reservations = reservations_obj.search([ - ('folio_id.date_order', '>=', self.date_start), - ('folio_id.date_order', '<=', self.date_end), - ('channel_type','=','call'), - ]) - offset = 1 - total_reservation_amount = 0.0 - for k_res, v_res in enumerate(reservations): - checkin_date = datetime.strptime(v_res.checkin, DEFAULT_SERVER_DATE_FORMAT) - checkout_date = datetime.strptime(v_res.checkout, DEFAULT_SERVER_DATE_FORMAT) - worksheet.write(k_res+offset, 0, v_res.state) - worksheet.write(k_res+offset, 1, v_res.folio_id.name) - worksheet.write(k_res+offset, 2, v_res.folio_id.date_order, - xls_cell_format_date) - worksheet.write(k_res+offset, 3, v_res.partner_id.name) - worksheet.write(k_res+offset, 4, v_res.room_type_id.name) - worksheet.write(k_res+offset, 5, v_res.nights) - worksheet.write(k_res+offset, 6, v_res.adults) - worksheet.write(k_res+offset, 7, checkin_date.strftime(date_format), - xls_cell_format_date) - worksheet.write(k_res+offset, 8, v_res.arrival_hour) - worksheet.write(k_res+offset, 9, checkout_date.strftime(date_format), - xls_cell_format_date) - worksheet.write(k_res+offset, 10, v_res.create_uid.name) - worksheet.write(k_res+offset, 11, v_res.price_total, - xls_cell_format_money) - total_reservation_amount += v_res.price_total - - folio_ids = reservations.mapped('folio_id.id') - folios = self.env['hotel.folio'].browse(folio_ids) - services = self.env['hotel.service'].browse() - for folio in folios: - services += folio.service_ids.filtered(lambda r: - r.channel_type == 'call' and r.folio_id.pending_amount < 1) - offset += len(reservations) - total_service_amount = k_line = 0.0 - for k_service, v_service in enumerate(services): - worksheet.write(k_service+offset, 1, v_service.folio_id.state) - worksheet.write(k_service+offset, 1, v_service.folio_id.name) - worksheet.write(k_service+offset, 2, v_service.folio_id.date_order, - xls_cell_format_date) - worksheet.write(k_service+offset, 3, v_service.folio_id.partner_id.name) - worksheet.write(k_service+offset, 4, v_service.product_id.name) - worksheet.write(k_service+offset, 5, v_service.product_qty) - worksheet.write(k_service+offset, 6, '') - worksheet.write(k_service+offset, 7, '') - worksheet.write(k_service+offset, 8, '') - worksheet.write(k_service+offset, 9, '') - worksheet.write(k_service+offset, 10, v_service .create_uid.name) - worksheet.write(k_service+offset, 11, v_service.price_total, - xls_cell_format_money) - total_service_amount += v_service.price_total - offset += len(services) - #~ if total_reservation_amount == 0 and total_service_amount == 0: - #~ raise UserError(_('No Hay reservas de Call Center')) - line = offset - if k_line: - line = k_line + offset - if total_reservation_amount > 0: - line += 1 - worksheet.write(line, 10, _('TOTAL RESERVAS')) - worksheet.write(line, 11, total_reservation_amount, - xls_cell_format_money) - if total_service_amount > 0: - line += 1 - worksheet.write(line, 10, _('TOTAL SERVICIOS')) - worksheet.write(line, 11, total_service_amount, - xls_cell_format_money) - line += 1 - worksheet.write(line, 10, _('TOTAL')) - worksheet.write(line, 11 , total_reservation_amount + total_service_amount, - xls_cell_format_money) - - worksheet = workbook.add_worksheet(_('Call Center Report - Cancelations')) - - worksheet.write('A1', _('Estado'), xls_cell_format_header) - worksheet.write('B1', _('Ficha'), xls_cell_format_header) - worksheet.write('C1', _('Fecha de Pedido'), xls_cell_format_header) - worksheet.write('D1', _('Cliente'), xls_cell_format_header) - worksheet.write('E1', _('Producto'), xls_cell_format_header) - worksheet.write('F1', _('Noches/Uds'), xls_cell_format_header) - worksheet.write('G1', _('Adultos'), xls_cell_format_header) - worksheet.write('H1', _('Checkin'), xls_cell_format_header) - worksheet.write('I1', _('In-Hora'), xls_cell_format_header) - worksheet.write('J1', _('Checkout'), xls_cell_format_header) - worksheet.write('K1', _('Creado por'), xls_cell_format_header) - worksheet.write('K1', _('Cancelado en'), xls_cell_format_header) - worksheet.write('L1', _('Precio Final'), xls_cell_format_header) - worksheet.write('M1', _('Precio Original'), xls_cell_format_header) - - worksheet.set_column('B:B', 20) - worksheet.set_column('C:C', 20) - worksheet.set_column('D:D', 20) - worksheet.set_column('E:E', 20) - worksheet.set_column('F:F', 13) - - reservations_obj = self.env['hotel.reservation'] - reservations = reservations_obj.search([ - ('last_updated_res', '>=', self.date_start), - ('last_updated_res', '<=', self.date_end), - ('channel_type','=','call'), - ('state','=','cancelled'), - ]) - offset = 1 - total_reservation_amount = 0.0 - for k_res, v_res in enumerate(reservations): - checkin_date = datetime.strptime(v_res.checkin, DEFAULT_SERVER_DATE_FORMAT) - checkout_date = datetime.strptime(v_res.checkout, DEFAULT_SERVER_DATE_FORMAT) - worksheet.write(k_res+offset, 0, v_res.state) - worksheet.write(k_res+offset, 1, v_res.folio_id.name) - worksheet.write(k_res+offset, 2, v_res.folio_id.date_order, - xls_cell_format_date) - worksheet.write(k_res+offset, 3, v_res.partner_id.name) - worksheet.write(k_res+offset, 4, v_res.room_type_id.name) - worksheet.write(k_res+offset, 5, v_res.nights) - worksheet.write(k_res+offset, 6, v_res.adults) - worksheet.write(k_res+offset, 7, checkin_date.strftime(date_format), - xls_cell_format_date) - worksheet.write(k_res+offset, 8, v_res.arrival_hour) - worksheet.write(k_res+offset, 9, checkout_date.strftime(date_format), - xls_cell_format_date) - worksheet.write(k_res+offset, 10, v_res.create_uid.name) - worksheet.write(k_res+offset, 9, v_res.last_updated_res, - xls_cell_format_date) - worksheet.write(k_res+offset, 11, v_res.price_total, - xls_cell_format_money) - worksheet.write(k_res+offset, 12, v_res.price_total - v_res.discount, - xls_cell_format_money) - total_reservation_amount += v_res.price_total - - offset += len(reservations) - - #~ if total_reservation_amount == 0 and total_service_amount == 0: - #~ raise UserError(_('No Hay reservas de Call Center')) - line = offset - if k_line: - line = k_line + offset - if total_reservation_amount > 0: - line += 1 - worksheet.write(line, 11, _('TOTAL RESERVAS')) - worksheet.write(line, 12, total_reservation_amount, - xls_cell_format_money) - - workbook.close() - file_data.seek(0) - tnow = fields.Datetime.now().replace(' ', '_') - return { - 'xls_filename': 'call_%s.xlsx' %self.env.user.company_id.property_name, - 'xls_binary': base64.encodestring(file_data.read()), - } - - def export(self): - self.write(self._export()) - return { - "type": "ir.actions.do_nothing", - } diff --git a/call_center_report/wizard/call_center_report.xml b/call_center_report/wizard/call_center_report.xml deleted file mode 100644 index 598a137d1..000000000 --- a/call_center_report/wizard/call_center_report.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - call.center.report.wizard - call.center.report.wizard - -
- - - - - - - - - - - - - - -
-
-
-
-
- - - Call Center Report Wizard - ir.actions.act_window - call.center.report.wizard - - form - new - - -
diff --git a/cash_daily_report/README.rst b/cash_daily_report/README.rst deleted file mode 100644 index be9027c75..000000000 --- a/cash_daily_report/README.rst +++ /dev/null @@ -1,13 +0,0 @@ -CASH DAILY REPORT -============= - -Export payments report in xls format - - -Credits -======= - -Creator ------------- - -* Alexandre Díaz diff --git a/cash_daily_report/__init__.py b/cash_daily_report/__init__.py deleted file mode 100644 index 351d1ee57..000000000 --- a/cash_daily_report/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import wizard diff --git a/cash_daily_report/__manifest__.py b/cash_daily_report/__manifest__.py deleted file mode 100644 index 33c4fc38a..000000000 --- a/cash_daily_report/__manifest__.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## - -{ - 'name': 'Cash Daily Report', - 'version': '1.0', - 'author': "Alexandre Díaz ", - 'website': 'https://www.eiqui.com', - 'category': 'reports', - 'summary': "Export payments report in xls format", - 'description': "Cash Daily Report", - 'depends': [ - 'account', - 'account_payment_return', - 'hotel', - ], - 'external_dependencies': { - 'python': ['xlsxwriter'] - }, - 'data': [ - 'wizard/cash_daily_report.xml', - 'data/menus.xml', - 'data/cron_jobs.xml', - ], - 'qweb': [], - 'test': [ - ], - - 'installable': True, - 'auto_install': False, - 'application': False, - 'license': 'AGPL-3', -} diff --git a/cash_daily_report/data/cron_jobs.xml b/cash_daily_report/data/cron_jobs.xml deleted file mode 100644 index bb556d2f2..000000000 --- a/cash_daily_report/data/cron_jobs.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - Automatic Period Lock Date - 1 - - days - -1 - - code - - - model.automatic_period_lock_date() - - - - - - diff --git a/cash_daily_report/data/menus.xml b/cash_daily_report/data/menus.xml deleted file mode 100644 index ef93963a4..000000000 --- a/cash_daily_report/data/menus.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - Internal Transfers - account.payment - tree,kanban,form,graph - {'default_payment_type': 'transfer', 'search_default_transfers_filter': 1} - [] - - -

- Click to register a payment -

- Payments are used to register liquidity movements (send, collect or transfer money). - You can then process those payments by your own means or by using installed facilities. -

-
-
- - - -
diff --git a/cash_daily_report/i18n/es.po b/cash_daily_report/i18n/es.po deleted file mode 100644 index 9b4a07faa..000000000 --- a/cash_daily_report/i18n/es.po +++ /dev/null @@ -1,203 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * cash_daily_report -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-02 10:07+0000\n" -"PO-Revision-Date: 2019-08-02 10:07+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:85 -#, python-format -msgid "Amount" -msgstr "Importe" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:78 -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -#, python-format -msgid "Cash Daily Report" -msgstr "Informe de caja" - -#. module: cash_daily_report -#: model:ir.actions.act_window,name:cash_daily_report.action_open_cash_daily_report_wizard -#: model:ir.ui.menu,name:cash_daily_report.cash_daily_report_wizard -msgid "Cash Daily Report Wizard" -msgstr "Informe de caja diaria" - -#. module: cash_daily_report -#: model:ir.actions.act_window,help:cash_daily_report.action_account_payments_internal -msgid "Click to register a payment" -msgstr "Pulse para registrar un pago" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:82 -#, python-format -msgid "Client/Supplier" -msgstr "Client/Supplier" - -#. module: cash_daily_report -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -msgid "Close" -msgstr "Cerrar" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_uid -msgid "Created by" -msgstr "Creado por" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_date -msgid "Created on" -msgstr "Creado en" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:83 -#, python-format -msgid "Date" -msgstr "Fecha" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_display_name -msgid "Display Name" -msgstr "Nombre mostrado" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_end -msgid "End Date" -msgstr "Fecha de finalización" - -#. module: cash_daily_report -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -msgid "Generate XLS" -msgstr "Generar XLS" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_id -msgid "ID" -msgstr "ID (identificación)" - -#. module: cash_daily_report -#: model:ir.ui.menu,name:cash_daily_report.hotel_transfer_menu -msgid "Internal Transfer" -msgstr "Transferencias Internas" - -#. module: cash_daily_report -#: model:ir.actions.act_window,name:cash_daily_report.action_account_payments_internal -msgid "Internal Transfers" -msgstr "Internal Transfers" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:84 -#, python-format -msgid "Journal" -msgstr "Diario" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard___last_update -msgid "Last Modified on" -msgstr "Última modificación en" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_uid -msgid "Last Updated by" -msgstr "Última actualización de" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_date -msgid "Last Updated on" -msgstr "Última actualización en" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:80 -#, python-format -msgid "Name" -msgstr "Nombre" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:159 -#, python-format -msgid "Not Any Payments" -msgstr "No hay movimientos" - -#. module: cash_daily_report -#: model:ir.ui.menu,name:cash_daily_report.hotel_payments_menu -msgid "Payments" -msgstr "Pagos" - -#. module: cash_daily_report -#: model:ir.actions.act_window,help:cash_daily_report.action_account_payments_internal -msgid "Payments are used to register liquidity movements (send, collect or transfer money).\n" -" You can then process those payments by your own means or by using installed facilities." -msgstr "Los pagos se utilizan para registrar movimientos de liquidez (enviar, recibir o transferir dinero).\n" -"Puede procesar esos pagos por sus propios medios o utilizando los servicios instalados." - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:81 -#, python-format -msgid "Reference" -msgstr "Referencia" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_start -msgid "Start Date" -msgstr "Fecha de Inicio" - -#. module: cash_daily_report -#: model:ir.ui.menu,name:cash_daily_report.hotel_supplier_payment_menu -msgid "Supplier Payments" -msgstr "Pagos a Proveedor" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:216 -#, python-format -msgid "TOTAL" -msgstr "TOTAL" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:201 -#, python-format -msgid "TOTAL EXPENSES" -msgstr "TOTAL EXPENSES" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:185 -#, python-format -msgid "TOTAL PAYMENT RETURNS" -msgstr "TOTAL DEVOLUCIONES" - -#. module: cash_daily_report -#: code:addons/cash_daily_report/wizard/cash_daily_report.py:169 -#, python-format -msgid "TOTAL PAYMENTS" -msgstr "TOTAL PAGOS" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_binary -msgid "Xls Binary" -msgstr "Xls Binary" - -#. module: cash_daily_report -#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_filename -msgid "Xls Filename" -msgstr "Xls Filename" - -#. module: cash_daily_report -#: model:ir.model,name:cash_daily_report.model_cash_daily_report_wizard -msgid "cash.daily.report.wizard" -msgstr "cash.daily.report.wizard" - -#. module: cash_daily_report -#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard -msgid "or" -msgstr "o" - diff --git a/cash_daily_report/wizard/__init__.py b/cash_daily_report/wizard/__init__.py deleted file mode 100644 index 7fb535a50..000000000 --- a/cash_daily_report/wizard/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import cash_daily_report diff --git a/cash_daily_report/wizard/cash_daily_report.py b/cash_daily_report/wizard/cash_daily_report.py deleted file mode 100644 index b08382146..000000000 --- a/cash_daily_report/wizard/cash_daily_report.py +++ /dev/null @@ -1,307 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from io import BytesIO -import datetime -import xlsxwriter -import base64 -from odoo import api, fields, models, _ -from openerp.exceptions import UserError -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT - - -class CashDailyReportWizard(models.TransientModel): - FILENAME = 'cash_daily_report.xls' - _name = 'cash.daily.report.wizard' - - @api.model - def automatic_period_lock_date(self): - # The secong month day close the mont previous - days = 2 - closeday = datetime.date.today().replace(day=days) - if datetime.date.today() >= closeday: - companies = self.env['res.company'].search([]) - for record in companies: - lastday = datetime.date.today().replace(day=1) + \ - datetime.timedelta(days=-1) - if record.period_lock_date != lastday: - record.write({ - 'period_lock_date': lastday - }) - - @api.model - @api.model - def _get_default_date_start(self): - return datetime.datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT) - - @api.model - def _get_default_date_end(self): - return datetime.datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT) - - date_start = fields.Date("Start Date", default=_get_default_date_start) - date_end = fields.Date("End Date", default=_get_default_date_end) - xls_filename = fields.Char() - xls_binary = fields.Binary() - - @api.model - def _export(self): - file_data = BytesIO() - workbook = xlsxwriter.Workbook(file_data, { - 'strings_to_numbers': True, - 'default_date_format': 'dd/mm/yyyy' - }) - - company_id = self.env.user.company_id - workbook.set_properties({ - 'title': 'Exported data from ' + company_id.name, - 'subject': 'Payments Data from Odoo of ' + company_id.name, - 'author': 'Odoo', - 'manager': u'Alexandre Díaz Cuadrado', - 'company': company_id.name, - 'category': 'Hoja de Calculo', - 'keywords': 'payments, odoo, data, ' + company_id.name, - 'comments': 'Created with Python in Odoo and XlsxWriter'}) - workbook.use_zip64() - - xls_cell_format_date = workbook.add_format({ - 'num_format': 'dd/mm/yyyy' - }) - xls_cell_format_money = workbook.add_format({ - 'num_format': '#,##0.00' - }) - xls_cell_format_header = workbook.add_format({ - 'bg_color': '#CCCCCC' - }) - - worksheet = workbook.add_worksheet(_('Cash Daily Report')) - - worksheet.write('A1', _('Name'), xls_cell_format_header) - worksheet.write('B1', _('Reference'), xls_cell_format_header) - worksheet.write('C1', _('Client/Supplier'), xls_cell_format_header) - worksheet.write('D1', _('Date'), xls_cell_format_header) - worksheet.write('E1', _('Journal'), xls_cell_format_header) - worksheet.write('F1', _('Amount'), xls_cell_format_header) - - worksheet.set_column('C:C', 50) - worksheet.set_column('D:D', 11) - - account_payments_obj = self.env['account.payment'] - account_payments = account_payments_obj.search([ - ('payment_date', '>=', self.date_start), - ('payment_date', '<=', self.date_end), - ]) - offset = 1 - total_account_payment_amount = 0.0 - total_account_payment = 0.0 - total_account_expenses = 0.0 - payment_journals = {} - expense_journals = {} - total_dates = {} - for k_payment, v_payment in enumerate(account_payments): - where = v_payment.partner_id.name - amount = v_payment.amount if v_payment.payment_type in ('inbound') \ - else -v_payment.amount - if v_payment.payment_type == 'transfer': - where = v_payment.destination_journal_id.name - total_account_payment += -amount - if v_payment.destination_journal_id.name not in payment_journals: - payment_journals.update({v_payment.destination_journal_id.name: -amount}) - else: - payment_journals[v_payment.destination_journal_id.name] += -amount - if v_payment.payment_date not in total_dates: - total_dates.update({v_payment.payment_date: {v_payment.destination_journal_id.name: -amount}}) - else: - if v_payment.destination_journal_id.name not in total_dates[v_payment.payment_date]: - total_dates[v_payment.payment_date].update({v_payment.destination_journal_id.name: -amount}) - else: - total_dates[v_payment.payment_date][v_payment.destination_journal_id.name] += -amount - if amount < 0: - total_account_expenses += -amount - if v_payment.journal_id.name not in expense_journals: - expense_journals.update({v_payment.journal_id.name: amount}) - else: - expense_journals[v_payment.journal_id.name] += amount - if v_payment.payment_date not in total_dates: - total_dates.update({v_payment.payment_date: {v_payment.journal_id.name: amount}}) - else: - if v_payment.journal_id.name not in total_dates[v_payment.payment_date]: - total_dates[v_payment.payment_date].update({v_payment.journal_id.name: amount}) - else: - total_dates[v_payment.payment_date][v_payment.journal_id.name] += amount - else: - total_account_payment += amount - if v_payment.journal_id.name not in payment_journals: - payment_journals.update({v_payment.journal_id.name: amount}) - else: - payment_journals[v_payment.journal_id.name] += amount - if v_payment.payment_date not in total_dates: - total_dates.update({v_payment.payment_date: {v_payment.journal_id.name: amount}}) - else: - if v_payment.journal_id.name not in total_dates[v_payment.payment_date]: - total_dates[v_payment.payment_date].update({v_payment.journal_id.name: amount}) - else: - total_dates[v_payment.payment_date][v_payment.journal_id.name] += amount - - worksheet.write(k_payment+offset, 0, v_payment.create_uid.login) - worksheet.write(k_payment+offset, 1, v_payment.communication) - worksheet.write(k_payment+offset, 2, where) - worksheet.write(k_payment+offset, 3, v_payment.payment_date, - xls_cell_format_date) - worksheet.write(k_payment+offset, 4, v_payment.journal_id.name) - worksheet.write(k_payment+offset, 5, amount, - xls_cell_format_money) - total_account_payment_amount += amount - - payment_returns_obj = self.env['payment.return'] - payment_returns = payment_returns_obj.search([ - ('date', '>=', self.date_start), - ('date', '<=', self.date_end), - ]) - offset += len(account_payments) - total_payment_returns_amount = k_line = 0.0 - return_journals = {} - for k_payment, v_payment in enumerate(payment_returns): - for k_line, v_line in enumerate(v_payment.line_ids): - if v_payment.journal_id.name not in return_journals: - return_journals.update({v_payment.journal_id.name: -v_line.amount}) - else: - return_journals[v_payment.journal_id.name] += -v_line.amount - - if v_payment.date not in total_dates: - total_dates.update({v_payment.date: {v_payment.journal_id.name: -v_line.amount}}) - else: - if v_payment.journal_id.name not in total_dates[v_payment.date]: - total_dates[v_payment.date].update({v_payment.journal_id.name: -v_line.amount}) - else: - total_dates[v_payment.date][v_payment.journal_id.name] += -v_line.amount - - worksheet.write(k_line+offset, 0, v_payment.create_uid.login) - worksheet.write(k_line+offset, 1, v_line.reference) - worksheet.write(k_line+offset, 2, v_line.partner_id.name) - worksheet.write(k_line+offset, 3, v_payment.date, - xls_cell_format_date) - worksheet.write(k_line+offset, 4, v_payment.journal_id.name) - worksheet.write(k_line+offset, 5, -v_line.amount, - xls_cell_format_money) - total_payment_returns_amount += -v_line.amount - offset += len(v_payment.line_ids) - if total_account_payment_amount == 0 and total_payment_returns_amount == 0: - raise UserError(_('Not Any Payments')) - line = offset - if k_line: - line = k_line + offset - - result_journals = {} - # NORMAL PAYMENTS - if total_account_payment != 0: - line += 1 - worksheet.write(line, 4, _('TOTAL PAYMENTS'), xls_cell_format_header) - worksheet.write(line, 5, total_account_payment, - xls_cell_format_header) - for journal in payment_journals: - line += 1 - worksheet.write(line, 4, _(journal)) - worksheet.write(line, 5, payment_journals[journal], - xls_cell_format_money) - if journal not in result_journals: - result_journals.update({journal: payment_journals[journal]}) - else: - result_journals[journal] += payment_journals[journal] - - # RETURNS - if total_payment_returns_amount != 0: - line += 1 - worksheet.write(line, 4, _('TOTAL PAYMENT RETURNS'), xls_cell_format_header) - worksheet.write(line, 5, total_payment_returns_amount, - xls_cell_format_header) - for journal in return_journals: - line += 1 - worksheet.write(line, 4, _(journal)) - worksheet.write(line, 5, return_journals[journal], - xls_cell_format_money) - if journal not in result_journals: - result_journals.update({journal: return_journals[journal]}) - else: - result_journals[journal] += return_journals[journal] - - # EXPENSES - if total_account_expenses != 0: - line += 1 - worksheet.write(line, 4, _('TOTAL EXPENSES'), xls_cell_format_header) - worksheet.write(line, 5, -total_account_expenses, - xls_cell_format_header) - for journal in expense_journals: - line += 1 - worksheet.write(line, 4, _(journal)) - worksheet.write(line, 5, -expense_journals[journal], - xls_cell_format_money) - if journal not in result_journals: - result_journals.update({journal: expense_journals[journal]}) - else: - result_journals[journal] += expense_journals[journal] - - #TOTALS - line += 1 - worksheet.write(line, 4, _('TOTAL'), xls_cell_format_header) - worksheet.write( - line, - 5, - total_account_payment + total_payment_returns_amount - total_account_expenses, - xls_cell_format_header) - for journal in result_journals: - line += 1 - worksheet.write(line, 4, _(journal)) - worksheet.write(line, 5, result_journals[journal], - xls_cell_format_money) - - worksheet = workbook.add_worksheet(_('Por dia')) - worksheet.write('A1', _('Date'), xls_cell_format_header) - columns = ('B1','C1','D1','E1','F1','G1','H1') - i = 0 - column_journal = {} - for journal in result_journals: - worksheet.write(columns[i], _(journal), xls_cell_format_header) - i += 1 - column_journal.update({journal: i}) - - worksheet.set_column('C:C', 50) - worksheet.set_column('D:D', 11) - - offset = 1 - total_dates = sorted(total_dates.items(), key=lambda x: x[0]) - for k_day, v_day in enumerate(total_dates): - worksheet.write(k_day+offset, 0, v_day[0]) - for journal in v_day[1]: - worksheet.write(k_day+offset, column_journal[journal], v_day[1][journal]) - - workbook.close() - file_data.seek(0) - tnow = fields.Datetime.now().replace(' ', '_') - return { - 'xls_filename': 'cash_daily_report_%s.xlsx' % tnow, - 'xls_binary': base64.encodestring(file_data.read()), - } - - - def export(self): - self.write(self._export()) - return { - "type": "ir.actions.do_nothing", - } diff --git a/cash_daily_report/wizard/cash_daily_report.xml b/cash_daily_report/wizard/cash_daily_report.xml deleted file mode 100644 index caab7f860..000000000 --- a/cash_daily_report/wizard/cash_daily_report.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - cash.daily.report.wizard - cash.daily.report.wizard - -
- - - - - - - - - - - - - - -
-
-
-
-
- - - Cash Daily Report Wizard - ir.actions.act_window - cash.daily.report.wizard - - form - new - - -
diff --git a/glasof_exporter/README.rst b/glasof_exporter/README.rst deleted file mode 100644 index 58b7e6f48..000000000 --- a/glasof_exporter/README.rst +++ /dev/null @@ -1,15 +0,0 @@ -GLASOF EXPORTER -============= - -** UNDER DEVELOPMENT: NOT USE IN PRODUCTION ** - -Export Odoo data to glasof xls format - - -Credits -======= - -Creator ------------- - -* Alexandre Díaz diff --git a/glasof_exporter/__init__.py b/glasof_exporter/__init__.py deleted file mode 100644 index 351d1ee57..000000000 --- a/glasof_exporter/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import wizard diff --git a/glasof_exporter/__manifest__.py b/glasof_exporter/__manifest__.py deleted file mode 100644 index 475fb102f..000000000 --- a/glasof_exporter/__manifest__.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## - -{ - 'name': 'Glasof Exporter', - 'version': '1.0', - 'author': "Alexandre Díaz ", - 'website': 'https://www.eiqui.com', - 'category': 'hotel/glasof', - 'summary': "Export Odoo Data to xls compatible with Glasof", - 'description': "Glasof Exporter", - 'depends': [ - 'account', - ], - 'external_dependencies': { - 'python': ['xlsxwriter'] - }, - 'data': [ - 'wizard/glasof_wizard.xml', - 'data/menus.xml', - ], - 'qweb': [], - 'test': [ - ], - - 'installable': True, - 'auto_install': False, - 'application': False, - 'license': 'AGPL-3', -} diff --git a/glasof_exporter/data/menus.xml b/glasof_exporter/data/menus.xml deleted file mode 100644 index 7b791eeaf..000000000 --- a/glasof_exporter/data/menus.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/glasof_exporter/wizard/__init__.py b/glasof_exporter/wizard/__init__.py deleted file mode 100644 index 2b033f952..000000000 --- a/glasof_exporter/wizard/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import glasof_wizard diff --git a/glasof_exporter/wizard/glasof_wizard.py b/glasof_exporter/wizard/glasof_wizard.py deleted file mode 100644 index 1e9ddc12d..000000000 --- a/glasof_exporter/wizard/glasof_wizard.py +++ /dev/null @@ -1,256 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from io import BytesIO -import xlsxwriter -import base64 -from odoo import api, fields, models, _ - - -class GlassofExporterWizard(models.TransientModel): - FILENAME = 'invoices_glasof.xls' - _name = 'glasof.exporter.wizard' - - date_start = fields.Date("Start Date") - date_end = fields.Date("End Date") - export_journals = fields.Boolean("Export Account Movements?", default=True) - export_invoices = fields.Boolean("Export Invoices?", default=True) - seat_num = fields.Integer("Seat Number Start", default=1) - xls_journals_filename = fields.Char() - xls_journals_binary = fields.Binary() - xls_invoices_filename = fields.Char() - xls_invoices_binary = fields.Binary() - - @api.model - def _export_journals(self): - file_data = BytesIO() - workbook = xlsxwriter.Workbook(file_data, { - 'strings_to_numbers': True, - 'default_date_format': 'dd/mm/yyyy' - }) - - company_id = self.env.user.company_id - workbook.set_properties({ - 'title': 'Exported data from ' + company_id.name, - 'subject': 'PMS Data from Odoo of ' + company_id.name, - 'author': 'Odoo ALDA PMS', - 'manager': 'Jose Luis Algara', - 'company': company_id.name, - 'category': 'Hoja de Calculo', - 'keywords': 'pms, odoo, alda, data, ' + company_id.name, - 'comments': 'Created with Python in Odoo and XlsxWriter'}) - workbook.use_zip64() - - xls_cell_format_seat = workbook.add_format({'num_format': '#'}) - xls_cell_format_date = workbook.add_format({ - 'num_format': 'dd/mm/yyyy' - }) - xls_cell_format_saccount = workbook.add_format({ - 'num_format': '000000' - }) - xls_cell_format_money = workbook.add_format({ - 'num_format': '#,##0.00' - }) - xls_cell_format_header = workbook.add_format({ - 'bg_color': '#CCCCCC' - }) - - worksheet = workbook.add_worksheet('Simples-1') - - worksheet.write('A1', _('Seat'), xls_cell_format_header) - worksheet.write('B1', _('Date'), xls_cell_format_header) - worksheet.write('C1', _('SubAccount'), xls_cell_format_header) - worksheet.write('D1', _('Description'), xls_cell_format_header) - worksheet.write('E1', _('Concept'), xls_cell_format_header) - worksheet.write('F1', _('Debit'), xls_cell_format_header) - worksheet.write('G1', _('Credit'), xls_cell_format_header) - worksheet.write('H1', _('Seat Type'), xls_cell_format_header) - - worksheet.set_column('B:B', 11) - worksheet.set_column('E:E', 50) - - account_move_obj = self.env['account.move'] - account_moves = account_move_obj.search([ - ('date', '>=', self.date_start), - ('date', '<=', self.date_end), - ]) - start_seat = self.seat_num - nrow = 1 - for move in account_moves: - nmove = True - for line in move.line_ids: - if line.journal_id.type in ('cash', 'bank'): - worksheet.write(nrow, 0, nmove and start_seat or '', - xls_cell_format_seat) - worksheet.write(nrow, 1, nmove and line.date or '', - xls_cell_format_date) - worksheet.write(nrow, 2, line.account_id.code, - xls_cell_format_saccount) - worksheet.write(nrow, 3, '') - worksheet.write(nrow, 4, line.ref and line.ref[:50] or '') - worksheet.write(nrow, 5, line.debit, xls_cell_format_money) - worksheet.write(nrow, 6, line.credit, - xls_cell_format_money) - worksheet.write(nrow, 7, '') - nmove = False - nrow += 1 - start_seat += 1 - - workbook.close() - file_data.seek(0) - tnow = fields.Datetime.now().replace(' ', '_') - return { - 'xls_journals_filename': 'journals_glasof_%s.xlsx' % tnow, - 'xls_journals_binary': base64.encodestring(file_data.read()), - } - - @api.model - def _export_invoices(self): - file_data = BytesIO() - workbook = xlsxwriter.Workbook(file_data, { - 'strings_to_numbers': True, - 'default_date_format': 'dd/mm/yyyy' - }) - - company_id = self.env.user.company_id - workbook.set_properties({ - 'title': 'Exported data from ' + company_id.name, - 'subject': 'PMS Data from Odoo of ' + company_id.name, - 'author': 'Odoo ALDA PMS', - 'manager': 'Jose Luis Algara', - 'company': company_id.name, - 'category': 'Hoja de Calculo', - 'keywords': 'pms, odoo, alda, data, ' + company_id.name, - 'comments': 'Created with Python in Odoo and XlsxWriter'}) - workbook.use_zip64() - - xls_cell_format_seat = workbook.add_format({'num_format': '#'}) - xls_cell_format_date = workbook.add_format({ - 'num_format': 'dd/mm/yyyy' - }) - xls_cell_format_saccount = workbook.add_format({ - 'num_format': '000000' - }) - xls_cell_format_money = workbook.add_format({ - 'num_format': '#,##0.00' - }) - xls_cell_format_odec = workbook.add_format({ - 'num_format': '#,#0.0' - }) - xls_cell_format_header = workbook.add_format({ - 'bg_color': '#CCCCCC' - }) - - worksheet = workbook.add_worksheet('ventas') - - account_inv_obj = self.env['account.invoice'] - account_invs = account_inv_obj.search([ - ('date', '>=', self.date_start), - ('date', '<=', self.date_end), - ]) - - nrow = 1 - for inv in account_invs: - if inv.partner_id.parent_id: - firstname = inv.partner_id.parent_id.firstname or '' - lastname = inv.partner_id.parent_id.lastname or '' - else: - firstname = inv.partner_id.firstname or '' - lastname = inv.partner_id.lastname or '' - - worksheet.write(nrow, 0, inv.number) - worksheet.write(nrow, 1, inv.date_invoice, xls_cell_format_date) - worksheet.write(nrow, 2, '') - worksheet.write(nrow, 3, inv.partner_id.vat and - inv.partner_id.vat[:2] or '') - worksheet.write(nrow, 4, inv.partner_id.vat and - inv.partner_id.vat[2:] or '') - worksheet.write(nrow, 5, lastname) - worksheet.write(nrow, 6, '') - worksheet.write(nrow, 7, firstname) - worksheet.write(nrow, 8, 705.0, xls_cell_format_odec) - worksheet.write(nrow, 9, inv.amount_untaxed, xls_cell_format_money) - if any(inv.tax_line_ids): - worksheet.write(nrow, - 10, - inv.tax_line_ids[0].tax_id.amount, - xls_cell_format_money) - else: - worksheet.write(nrow, 10, '') - worksheet.write(nrow, 11, inv.tax_line_ids and - inv.tax_line_ids[0].amount or '', - xls_cell_format_money) - worksheet.write(nrow, 12, '') - worksheet.write(nrow, 13, '') - worksheet.write(nrow, 14, '') - worksheet.write(nrow, 15, '') - worksheet.write(nrow, 16, '') - worksheet.write(nrow, 17, '') - worksheet.write(nrow, 18, '') - worksheet.write(nrow, 19, '') - worksheet.write(nrow, 20, '') - worksheet.write(nrow, 21, 'S') - worksheet.write(nrow, 22, '') - if inv.type == 'out_refund': - worksheet.write(nrow, 23, inv.invoice_origin) - else: - worksheet.write(nrow, 23, '') - worksheet.write(nrow, 24, '') - worksheet.write(nrow, 25, '') - worksheet.write(nrow, 27, '') - worksheet.write(nrow, 28, '') - worksheet.write(nrow, 29, '') - worksheet.write(nrow, 30, '') - worksheet.write(nrow, 31, '') - worksheet.write(nrow, 32, '') - worksheet.write(nrow, 33, '') - worksheet.write(nrow, 34, '') - worksheet.write(nrow, 35, '') - worksheet.write(nrow, 36, '') - worksheet.write(nrow, 37, '') - worksheet.write(nrow, 38, '') - worksheet.write(nrow, 39, '') - worksheet.write(nrow, 40, '') - worksheet.write(nrow, 41, '') - worksheet.write(nrow, 42, '') - worksheet.write(nrow, 43, '430') - nrow += 1 - - workbook.add_worksheet('compras') - workbook.close() - file_data.seek(0) - tnow = fields.Datetime.now().replace(' ', '_') - return { - 'xls_invoices_filename': 'invoices_glasof_%s.xlsx' % tnow, - 'xls_invoices_binary': base64.encodestring(file_data.read()), - } - - - def export(self): - towrite = {} - if self.export_journals: - towrite.update(self._export_journals()) - if self.export_invoices: - towrite.update(self._export_invoices()) - if any(towrite): - self.write(towrite) - return { - "type": "ir.actions.do_nothing", - } diff --git a/glasof_exporter/wizard/glasof_wizard.xml b/glasof_exporter/wizard/glasof_wizard.xml deleted file mode 100644 index 4b0939968..000000000 --- a/glasof_exporter/wizard/glasof_wizard.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - glasof.exporter.wizard - glasof.exporter.wizard - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - Export to Glasof - ir.actions.act_window - glasof.exporter.wizard - - form - new - - -
diff --git a/hotel_calendar/README.rst b/hotel_calendar/README.rst deleted file mode 100644 index 9a77798c3..000000000 --- a/hotel_calendar/README.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. This file is going to be generated by oca-gen-addon-readme. Manual changes will be overwritten. - -HOTEL CALENDAR -============== -This module allows you to handle reservations, prices and restriction plans in a user friendly calendar view. - -Description ------------- -This module extends the functionality of roomdoo. - -The calendar displays your rooms in a range of dates. -The rooms can be filtered by class, type or even amenities creating new calendars for easily manage all your reservations. -You can manage prices and restrictions day by day using the calendar management view. - -This module adds two new view types: ``pms`` and ``mpms``. -The module also incorporates a longpolling for delivering instant notification when using the calendar. - -Installation ------------- -This module depends on modules ``hotel``, ``bus``, ``web``, ``calendar``, and ``web_widget_color``. -Ensure yourself to have all them in your addons list. - -Configuration -------------- -No action required. The module is pre-configured with default values. - -You will find the hotel calendar settings in `Settings > Users & Companies > Hotels > Your Hotel > Calendar Settings Tab`. - -Reservation colors can be configured by company in `Settings > Users & Companies > Companies > Your Company > Hotel Preferences Tab.` - -Usage ------ -To use this module, you need to: - -* Go to Hotel Calendar menu for managing reservations. -* Go to Hotel Calendar Management for managing prices and restrictions. -* Go to Hotel Management/Configuration/Calendars menu for managing calendar tabs. - -Shortcuts -_________ -* ``CTRL + LEFT MOUSE CLICK`` on a reservation - start reservation swap -* ``ESC`` - cancel active action (ie. swap) - - -Credits -------- - -Authors -_______ -- Alexandre Díaz - -Contributors -____________ -* Pablo Quesada - -Roadmap -------- -* [ ] Implement the calendar view as an Odoo native view type. -* [ ] Re-design the calendar using SVG or other Odoo native approach. - -Do you want to contribute? Please, do not hesitate to contact any of the authors or contributors. \ No newline at end of file diff --git a/hotel_calendar/__init__.py b/hotel_calendar/__init__.py deleted file mode 100644 index bc60815fd..000000000 --- a/hotel_calendar/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import models -from . import controllers diff --git a/hotel_calendar/__manifest__.py b/hotel_calendar/__manifest__.py deleted file mode 100644 index 3008030fa..000000000 --- a/hotel_calendar/__manifest__.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -{ - 'name': 'Roomdoo Calendar', - 'summary': 'A calendar view for user friendly handling your roomdoo property.', - 'version': '11.0.2.0', - 'development_status': 'Beta', - 'category': 'Generic Modules/Hotel Management', - 'website': 'https://github.com/hootel/hootel', - 'author': 'Alexandre Díaz ', - 'license': "AGPL-3", - 'application': False, - 'installable': True, - 'depends': [ - 'bus', - 'web', - 'calendar', - 'hotel', - 'web_widget_color', - ], - # 'external_dependencies': { - # 'python': [] - # }, - 'data': [ - 'views/general.xml', - 'views/actions.xml', - 'views/inherited_hotel_property_views.xml', - 'views/inherited_res_company_views.xml', - 'views/inherited_res_users_views.xml', - 'views/hotel_reservation_views.xml', - 'views/hotel_calendar_management_views.xml', - 'views/hotel_calendar_views.xml', - 'data/menus.xml', - 'security/ir.model.access.csv', - ], - 'qweb': [ - 'static/src/xml/hotel_calendar_management_view.xml', - 'static/src/xml/hotel_calendar_templates.xml', - 'static/src/xml/hotel_calendar_view.xml', - ], -} diff --git a/hotel_calendar/controllers/__init__.py b/hotel_calendar/controllers/__init__.py deleted file mode 100644 index de7342fae..000000000 --- a/hotel_calendar/controllers/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import bus diff --git a/hotel_calendar/controllers/bus.py b/hotel_calendar/controllers/bus.py deleted file mode 100644 index ebb36b2e8..000000000 --- a/hotel_calendar/controllers/bus.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.http import request -from odoo.addons.bus.controllers.main import BusController - -HOTEL_BUS_CHANNEL_ID = 'hpublic' - - -# More info... -# https://github.com/odoo/odoo/commit/092cf33f93830daf5e704b964724bdf8586da8d9 -class Controller(BusController): - def _poll(self, dbname, channels, last, options): - if request.session.uid: - # registry, cr, uid, context = request.registry, request.cr, \ - # request.session.uid, request.context - channels = channels + [( - request.db, - 'hotel.reservation', - HOTEL_BUS_CHANNEL_ID - )] - return super(Controller, self)._poll(dbname, channels, last, options) diff --git a/hotel_calendar/data/menus.xml b/hotel_calendar/data/menus.xml deleted file mode 100644 index 9860b6d56..000000000 --- a/hotel_calendar/data/menus.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Hotel Calendar - hotel.reservation - pms - - - - Hotel Calendar Management - hotel.calendar.management - mpms - - - - - - - - - diff --git a/hotel_calendar/i18n/es.po b/hotel_calendar/i18n/es.po deleted file mode 100644 index 110018e03..000000000 --- a/hotel_calendar/i18n/es.po +++ /dev/null @@ -1,1383 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * hotel_calendar -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-03-09 18:34+0000\n" -"PO-Revision-Date: 2019-03-10 10:05+0100\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Language: es\n" -"X-Generator: Poedit 1.8.7.1\n" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "0 Days" -msgstr "0 Días" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "1 Days" -msgstr "1 Día" - -#. module: hotel_calendar -#: selection:res.users,npms_default_num_days:0 -#: selection:res.users,pms_default_num_days:0 -msgid "1 Month" -msgstr "1 Mes" - -#. module: hotel_calendar -#: selection:res.users,npms_default_num_days:0 -#: selection:res.users,pms_default_num_days:0 -msgid "1 Week" -msgstr "1 Semana" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "2 Days" -msgstr "2 Días" - -#. module: hotel_calendar -#: selection:res.users,npms_default_num_days:0 -#: selection:res.users,pms_default_num_days:0 -msgid "2 Weeks" -msgstr "2 Semanas" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "3 Days" -msgstr "3 Días" - -#. module: hotel_calendar -#: selection:res.users,npms_default_num_days:0 -#: selection:res.users,pms_default_num_days:0 -msgid "3 Weeks" -msgstr "3 Semanas" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "4 Days" -msgstr "4 Días" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "5 Days" -msgstr "5 Días" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week_offset:0 -#: selection:res.users,pms_end_day_week_offset:0 -msgid "6 Days" -msgstr "6 Días" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:21 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:43 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:134 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:262 -#, python-format -msgid "Adults:" -msgstr "Adultos:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:49 -#, python-format -msgid "All" -msgstr "Todo" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_npms_allowed_events_tags -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_allowed_events_tags -msgid "Allow Calander Event Tags" -msgstr "Permitir Eventos etiquetados en el Calendario" - -#. module: hotel_calendar -#: selection:res.users,pms_type_move:0 -msgid "Allow Invalid" -msgstr "Permitir Inválidas" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_npms_end_day_week_offset -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_end_day_week_offset -msgid "Also illuminate the previous" -msgstr "Sombrear también los previos" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_amenity_ids -msgid "Amenity" -msgstr "Característica" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:59 -#, python-format -msgid "Are you sure you want to change these prices?" -msgstr "Estás seguro de que quieres modificar estos precios?" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:53 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:67 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:81 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:89 -#, python-format -msgid "Are you sure you want to make this changes?" -msgstr "¿Estás seguo de que quieres confirmar estos cambios?" - -#. module: hotel_calendar -#: selection:res.users,pms_type_move:0 -msgid "Assisted" -msgstr "Asistido" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:117 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:276 -#, python-format -msgid "Availability" -msgstr "Disponibilidad" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:102 -#, python-format -msgid "Books" -msgstr "Reservas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:115 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:274 -#, python-format -msgid "C. Arrival" -msgstr "Cerrar Llegada" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:114 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:273 -#, python-format -msgid "C. Departure" -msgstr "Cerrar Salida" - -#. module: hotel_calendar -#: model:ir.ui.view,arch_db:hotel_calendar.res_users_view_form -msgid "Calendar (PMS)" -msgstr "Calendario (PMS)" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_view.js:43 -#, python-format -msgid "Calendar MPMS" -msgstr "Calendario MPMS" - -#. module: hotel_calendar -#: model:ir.ui.view,arch_db:hotel_calendar.res_users_view_form -msgid "Calendar Management (Revenue PMS)" -msgstr "Calendario de Configuración (Revenue PMS)" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js:163 -#, python-format -msgid "Calendar PMS" -msgstr "Calendario (PMS)" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:365 -#, python-format -msgid "Calendar Settings" -msgstr "Configuración Calendario" - -#. module: hotel_calendar -#: model:ir.ui.menu,name:hotel_calendar.hotel_calendar_record_menu -msgid "Calendars" -msgstr "Calendarios" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:130 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:289 -#, python-format -msgid "Cancel" -msgstr "Cancelar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:72 -#, python-format -msgid "Cancelled" -msgstr "Canceladas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:350 -#, python-format -msgid "Check-In:" -msgstr "Entrada:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:351 -#, python-format -msgid "Check-Out:" -msgstr "Salida:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:206 -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_stay -#, python-format -msgid "Checkin" -msgstr "Checkin" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:12 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:34 -#, python-format -msgid "Checkin:" -msgstr "Entrada:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js:241 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:35 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:105 -#, python-format -msgid "Checkins" -msgstr "Checkins" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_checkout -msgid "Checkout" -msgstr "Checkout" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:15 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:37 -#, python-format -msgid "Checkout:" -msgstr "Salida" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:26 -#, python-format -msgid "Checkouts" -msgstr "Checkouts" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:135 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:263 -#, python-format -msgid "Children:" -msgstr "Niños:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:129 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:288 -#, python-format -msgid "Clone" -msgstr "Clonar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:113 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:272 -#, python-format -msgid "Closed" -msgstr "Cerrado" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:335 -#, python-format -msgid "Closed Arrival:" -msgstr "Cerrar Llegada:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:336 -#, python-format -msgid "Closed Departure:" -msgstr "Cerrar Salida:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:334 -#, python-format -msgid "Closed:" -msgstr "Cerrado:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:122 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:281 -#, python-format -msgid "Clousure" -msgstr "Cerrado" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_reservation_reserve_color -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_reservation_reserve_color_text -msgid "Color" -msgstr "Color" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:648 -#, python-format -msgid "Confirm Reservation Changes" -msgstr "Confirmar cambios de reserva" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:568 -#, python-format -msgid "Confirm Reservation Swap" -msgstr "Confirmar intercambio de reservas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:516 -#, python-format -msgid "Confirm Split Reservation" -msgstr "Confirmar división de reserva" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:547 -#, python-format -msgid "Confirm Unify Reservations" -msgstr "Confirmar fusión de reservas" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_reservation -msgid "Confirmed Reservation " -msgstr "Reservas Confirmada" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:274 -#, python-format -msgid "Continue" -msgstr "Continuar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:127 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:286 -#, python-format -msgid "Copy" -msgstr "Copar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:768 -#, python-format -msgid "Create: " -msgstr "Creado: " - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar_create_uid -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_create_uid -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management_create_uid -msgid "Created by" -msgstr "Creado por" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar_create_date -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_create_date -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management_create_date -msgid "Created on" -msgstr "Creado en" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_npms_default_num_days -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_default_num_days -msgid "Default number of days" -msgstr "Num. por defecto de días" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_npms_denied_events_tags -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_denied_events_tags -msgid "Deny Calander Event Tags" -msgstr "Denegar Eventos etiquetados en el Calendario" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar_display_name -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_display_name -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management_display_name -msgid "Display Name" -msgstr "Nombre mostrado" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:81 -#, python-format -msgid "Divide" -msgstr "Dividir" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:378 -#, python-format -msgid "Divide Rooms by Capacity" -msgstr "Dividir las filas por capacidad" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_divide_rooms_by_capacity -msgid "Divide rooms by capacity" -msgstr "Dividir las filas por capacidad" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:342 -#, python-format -msgid "Do you want to confirm this folio?" -msgstr "Deseas confirmar la ficha?" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:359 -#, python-format -msgid "Do you want to save these changes?" -msgstr "Deseas confirmar la ficha?" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_dontsell -msgid "Dont Sell" -msgstr "No vender" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:106 -#, python-format -msgid "Email not provided" -msgstr "Email no proporcionado" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:279 -#, python-format -msgid "End" -msgstr "Fin" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_npms_end_day_week -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_end_day_week -msgid "End day of week" -msgstr "Último día de Semana" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:25 -#, python-format -msgid "FROM" -msgstr "DE" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:116 -#, python-format -msgid "Filters" -msgstr "Filtros" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_folio.py:24 -#, python-format -msgid "Folio Deleted" -msgstr "Ficha Eliminada" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:214 -#, python-format -msgid "Folio Payments" -msgstr "Pagos en Ficha" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:146 -#, python-format -msgid "Folio Pending" -msgstr "Pendiente en Ficha" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js:247 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:111 -#, python-format -msgid "Folios" -msgstr "Fichas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:123 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:282 -#, python-format -msgid "Free Rooms" -msgstr "Habitaciones Libres" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Friday" -msgstr "Viernes" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:358 -#, python-format -msgid "Have unsaved changes!" -msgstr "Tienes cambios sin guardar!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js:22 -#: model:ir.actions.act_window,name:hotel_calendar.action_hotel_calendar -#: model:ir.actions.act_window,name:hotel_calendar.hotel_calendar_action_form_tree -#: model:ir.ui.menu,name:hotel_calendar.hotel_calendar_menu -#: model:ir.ui.view,arch_db:hotel_calendar.hotel_calendar_view_form -#: model:ir.ui.view,arch_db:hotel_calendar.hotel_calendar_view_tree -#, python-format -msgid "Hotel Calendar" -msgstr "Calendario del Hotel" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:22 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:57 -#: model:ir.actions.act_window,name:hotel_calendar.action_hotel_calendar_management -#: model:ir.ui.menu,name:hotel_calendar.hotel_calendar_management_menu -#, python-format -msgid "Hotel Calendar Management" -msgstr "Calendario de Configuración del Hotel" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_hotel_folio -msgid "Hotel Folio" -msgstr "Ficha de reservas" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_hotel_reservation -msgid "Hotel Reservation" -msgstr "Reserva del hotel" - -#. module: hotel_calendar -#: model:ir.actions.act_window,name:hotel_calendar.hotel_reservation_action_checkin -msgid "Hotel folio checkin" -msgstr "Hotel Ficha Checkin" - -#. module: hotel_calendar -#: model:ir.actions.act_window,name:hotel_calendar.hotel_reservation_action_checkout -msgid "Hotel folio checkout" -msgstr "Hotel Ficha Checkout" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar_id -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_id -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management_id -msgid "ID" -msgstr "ID (identificación)" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/hotel_calendar_management.py:198 -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:367 -#, python-format -msgid "Input Error: No dates defined!" -msgstr "Error de entrada: ¡no hay fechas definidas!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:592 -#, python-format -msgid "Invalid Reservation Swap" -msgstr "Intercambio no válido" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:73 -#, python-format -msgid "Invalid Swap Operation, can't make this movement :/" -msgstr "No podemos hacer la operación, movimiento no válido de reservas :/" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:452 -#, python-format -msgid "Invalid swap parameters" -msgstr "Valores incorrectos para el swap" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:221 -#, python-format -msgid "Invoice Folio" -msgstr "Facturar Ficha" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js:244 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:108 -#, python-format -msgid "Invoices" -msgstr "Facturas" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar___last_update -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar___last_update -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management___last_update -msgid "Last Modified on" -msgstr "Última modificación en" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar_write_uid -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management_write_uid -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_write_uid -msgid "Last Updated by" -msgstr "Última actualización de" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_bus_hotel_calendar_write_date -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_management_write_date -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_write_date -msgid "Last Updated on" -msgstr "Última actualización en" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:62 -#, python-format -msgid "Launch Massive Changes" -msgstr "Guardar Cambios Masivos" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_reservation -msgid "Letter Confirmed Reservation " -msgstr "Texto de Reserva confirmada" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_pre_reservation -msgid "Letter Pre-reservation" -msgstr "Texto de Reserva sin confirmar" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_stay -msgid "Letter Checkin" -msgstr "Texto de Checkin (Dentro) " - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_checkout -msgid "Letter Checkout" -msgstr "Texto de Checkout (Fuera)" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_dontsell -msgid "Letter Dont Sell" -msgstr "Texto de Fuera de Servicio " - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_to_assign -msgid "Letter Ota to Assign" -msgstr "Texto de Por Asignar" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_reservation_pay -msgid "Letter Paid Reservation" -msgstr "Texto de Reserva Pagada" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_payment_pending -msgid "Letter Payment Pending" -msgstr "Texto de Pagos Pendientes" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_staff -msgid "Letter Staff" -msgstr "Texto de Staff" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_letter_stay_pay -msgid "Letter Stay Pay" -msgstr "Texto de Checkin Pagado" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_location_ids -msgid "Location" -msgstr "Ubicación" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:51 -#, python-format -msgid "Low" -msgstr "Bajo" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:352 -#, python-format -msgid "Made by:" -msgstr "Hecho por:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:119 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:278 -#, python-format -msgid "Max. Stay" -msgstr "Max. Estancia" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:121 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:280 -#, python-format -msgid "Max. Stay Arrival" -msgstr "Max. Stay Arrival" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:333 -#, python-format -msgid "Max. Stay Arrival:" -msgstr "Max. Est. Llegada:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:332 -#, python-format -msgid "Max. Stay:" -msgstr "Max. Estancia:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:50 -#, python-format -msgid "Medium" -msgstr "Medio" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:118 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:277 -#, python-format -msgid "Min. Stay" -msgstr "Min. Estancia" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:120 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:279 -#, python-format -msgid "Min. Stay Arrival" -msgstr "Min. Estancia Llegada" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:331 -#, python-format -msgid "Min. Stay:" -msgstr "Min. Estancia:" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Monday" -msgstr "Lunes" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_name -msgid "Name" -msgstr "Nombre" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:97 -#, python-format -msgid "Name, Mail, Vat, Book..." -msgstr "Nombre, Mail, NIF, Nº Reserva..." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:348 -#, python-format -msgid "Name:" -msgstr "Nombre:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:326 -#, python-format -msgid "Nights:" -msgstr "Noches" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:527 -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:558 -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:606 -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:678 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:448 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:590 -#, python-format -msgid "No" -msgstr "No" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:124 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:283 -#, python-format -msgid "No OTA" -msgstr "No OTA" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:124 -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:431 -#, python-format -msgid "No board services" -msgstr "Sin servicios incluidos" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:120 -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:428 -#, python-format -msgid "No reason given" -msgstr "Sin motivo explícito" - -#. module: hotel_calendar -#: selection:res.users,pms_type_move:0 -msgid "Normal" -msgstr "Normal" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:595 -#, python-format -msgid "Oops, Ok!" -msgstr "Oops, Ok!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:112 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:271 -#, python-format -msgid "Open" -msgstr "Abrir" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:125 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:284 -#, python-format -msgid "Options" -msgstr "Opciones" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_to_assign -msgid "Ota Reservation to Assign" -msgstr "Reserva por Asignar" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:78 -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:101 -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:400 -#, python-format -msgid "Out of service" -msgstr "Fuera de Servicio" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:62 -#, python-format -msgid "Overbook." -msgstr "Overbook." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:321 -#, python-format -msgid "Overbooking Management" -msgstr "Gestión de Overbooking" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_stay_pay -msgid "Paid Checkin" -msgstr "Checkin Pagado" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_reservation_pay -msgid "Paid Reservation" -msgstr "Reserva Pagada" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:128 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:287 -#, python-format -msgid "Paste" -msgstr "Pegar" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_payment_pending -msgid "Payment Pending" -msgstr "Pagos Pendientes" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:105 -#, python-format -msgid "Phone not provided" -msgstr "Teléfono no disponible" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_pre_reservation -msgid "Pre-reservation" -msgstr "Reserva sin Confirmar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:116 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:275 -#, python-format -msgid "Price" -msgstr "Precio" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_product_pricelist -msgid "Pricelist" -msgstr "Tarifas" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_product_pricelist_item -msgid "Pricelist item" -msgstr "Elemento Tarifa" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:768 -#, python-format -msgid "Reservation" -msgstr "Reserva" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:486 -#, python-format -msgid "Reservation Created" -msgstr "Reserva Creada" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:500 -#, python-format -msgid "Reservation Deleted" -msgstr "Reserva Eliminada" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:216 -#, python-format -msgid "Reservation Payments" -msgstr "Pagos de la reserva" - -#. module: hotel_calendar -#: model:ir.ui.view,arch_db:hotel_calendar.res_users_view_form -msgid "Reservation States Colours" -msgstr "Colores por estado de la Reserva" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_type_move -msgid "Reservation move mode" -msgstr "Modo de Movimiento de Reservas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js:238 -#, python-format -msgid "Reservations" -msgstr "Reservas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:31 -#, python-format -msgid "Reserve changed:" -msgstr "Reserva modificada:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:9 -#, python-format -msgid "Reserve unchanged:" -msgstr "Reserva no modificada:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:126 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:285 -#, python-format -msgid "Reset" -msgstr "Restablecer" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_room_type_ids -msgid "Room Type" -msgstr "Tipo de Habitación" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:307 -#, python-format -msgid "Room Type:" -msgstr "Tipo de Habitación:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:18 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:40 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:349 -#, python-format -msgid "Room:" -msgstr "Habitación:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:99 -#, python-format -msgid "Sales Channel:" -msgstr "Canal de Venta:" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Saturday" -msgstr "Sábado" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:12 -#, python-format -msgid "Save Changes" -msgstr "Guardar Cambios" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_hotel_calendar_segmentation_ids -msgid "Segmentation" -msgstr "Segmentación" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:120 -#, python-format -msgid "Select Amenities..." -msgstr "Seleccionar caraterísticas..." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:119 -#, python-format -msgid "Select Location..." -msgstr "Selecciones ubicación..." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:118 -#, python-format -msgid "Select Segmentation..." -msgstr "Seleccionar Segmentación..." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:121 -#, python-format -msgid "Select Type..." -msgstr "Seleccionar Tipo..." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:210 -#, python-format -msgid "Send Reservation Email" -msgstr "Enviar Mail de Reserva" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:377 -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_show_availability -#, python-format -msgid "Show Availability" -msgstr "Mostrar Disponibilidad" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:375 -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_show_notifications -#, python-format -msgid "Show Notifications" -msgstr "Mostrar Notificaciones" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_show_num_rooms -msgid "Show Num. Rooms" -msgstr "Num. Habitaciones a mostrar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:376 -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_pms_show_pricelist -#, python-format -msgid "Show Pricelist" -msgstr "Mostrar Tarifas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:80 -#, python-format -msgid "Split Reservation" -msgstr "Dividir Reserva" - -#. module: hotel_calendar -#: model:ir.model.fields,field_description:hotel_calendar.field_res_users_color_staff -msgid "Staff" -msgstr "Staff" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:284 -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:614 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:44 -#, python-format -msgid "Start Swap" -msgstr "Comenzar Intercambio" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Sunday" -msgstr "Domingo" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:66 -#, python-format -msgid "Swap Reservations" -msgstr "Intercambio reservas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:34 -#, python-format -msgid "TO" -msgstr "A" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:105 -#, python-format -msgid "TODO: add call center information" -msgstr "TODO: add call center information" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:5 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:65 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:79 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:87 -#, python-format -msgid "The following changes will be made..." -msgstr "Los próximos cambios serán realizados..." - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:6 -#, python-format -msgid "This reservation belongs to a folio with more reservations!" -msgstr "Esta reserva pertenece a un folio con más reservas!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:233 -#, python-format -msgid "This reservation is part of splitted reservation." -msgstr "Ésta reserva es solo una parte de una reserva dividida." - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Thursday" -msgstr "Jueves" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:373 -#, python-format -msgid "Toggle Advance Controls" -msgstr "Mostrar Controles Avanzados (Alt+x)" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:161 -#, python-format -msgid "Total Paid" -msgstr "Total Pagado" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Tuesday" -msgstr "Martes" - -#. module: hotel_calendar -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:417 -#: code:addons/hotel_calendar/models/inherited_hotel_reservation.py:418 -#, python-format -msgid "Undefined" -msgstr "Indefinido" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:90 -#, python-format -msgid "Unify" -msgstr "Fusionar" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:88 -#, python-format -msgid "Unify Reservations" -msgstr "Fusionar Reservas" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:436 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:578 -#, python-format -msgid "Unsaved Changes!" -msgstr "Tienes cambios sin guardar!" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_res_users -msgid "Users" -msgstr "Usuarios" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:198 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:290 -#, python-format -msgid "View Folio Details" -msgstr "Ver detalles de la Ficha" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml:47 -#, python-format -msgid "View Mode:" -msgstr "Modo de Visualización:" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:202 -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_templates.xml:294 -#, python-format -msgid "View Reservation Details" -msgstr "Ver detalles de la reserva" - -#. module: hotel_calendar -#: selection:res.users,npms_end_day_week:0 -#: selection:res.users,pms_end_day_week:0 -msgid "Wednesday" -msgstr "Miércoles" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/xml/hotel_calendar_view.xml:52 -#, python-format -msgid "Wizard" -msgstr "Wizard" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:651 -#, python-format -msgid "Yes, change it" -msgstr "Sí, Cambiálo!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js:439 -#: code:addons/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v.js:581 -#, python-format -msgid "Yes, save it" -msgstr "Sí, Guardálo!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:519 -#, python-format -msgid "Yes, split it" -msgstr "Sí, Divídela!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:571 -#, python-format -msgid "Yes, swap it" -msgstr "Sí, Intercámbialas!" - -#. module: hotel_calendar -#. openerp-web -#: code:addons/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js:550 -#, python-format -msgid "Yes, unify it" -msgstr "Sí, Fusionálas!" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_bus_hotel_calendar -msgid "bus.hotel.calendar" -msgstr "bus.hotel.calendar" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_hotel_calendar -msgid "hotel.calendar" -msgstr "hotel.calendar" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_hotel_calendar_management -msgid "hotel.calendar.management" -msgstr "hotel.calendar.management" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_hotel_room_type_restriction_item -msgid "hotel.room.type.restriction.item" -msgstr "hotel.room.type.restriction.item" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_ir_actions_act_window_view -msgid "ir.actions.act_window.view" -msgstr "ir.actions.act_window.view" - -#. module: hotel_calendar -#: model:ir.model,name:hotel_calendar.model_ir_ui_view -msgid "ir.ui.view" -msgstr "ir.ui.view" diff --git a/hotel_calendar/models/__init__.py b/hotel_calendar/models/__init__.py deleted file mode 100644 index 714a80ba9..000000000 --- a/hotel_calendar/models/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import inherited_hotel_property -from . import hotel_calendar -from . import bus_hotel_calendar -from . import hotel_calendar_management -from . import inherited_hotel_reservation -from . import inherited_res_company -from . import inherited_res_users -from . import inherited_hotel_room_type_restriction_item -from . import inherited_product_pricelist_item -from . import inherited_hotel_folio -from . import ir_actions_act_window_view -from . import ir_ui_view diff --git a/hotel_calendar/models/bus_hotel_calendar.py b/hotel_calendar/models/bus_hotel_calendar.py deleted file mode 100644 index c0bffeef3..000000000 --- a/hotel_calendar/models/bus_hotel_calendar.py +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from datetime import datetime -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT -from odoo import models, api -from odoo.addons.hotel_calendar.controllers.bus import HOTEL_BUS_CHANNEL_ID - - -class BusHotelCalendar(models.TransientModel): - _name = 'bus.hotel.calendar' - - ''' - action: - - create - - write - - unlink - - cancelled - ntype: - - notif : Show a normal notification - - warn : Show a warning notification - - noshow : Don't show any notification - ''' - # Business methods - @api.model - def _generate_reservation_notif(self, vals): - user_id = self.env['res.users'].browse(self.env.uid) - return { - 'type': 'reservation', - 'action': vals['action'], - 'subtype': vals['type'], - 'title': vals['title'], - 'username': user_id.partner_id.name, - 'userid': user_id.id, - 'reservation': { - 'room_id': vals['room_id'], - 'id': vals['reserv_id'], - 'name': vals['partner_name'], - 'adults': vals['adults'], - 'childer': vals['children'], - 'checkin': vals['checkin'], - 'checkout': vals['checkout'], - 'folio_id': vals['folio_id'], - 'bgcolor': vals['reserve_color'], - 'color': vals['reserve_color_text'], - 'splitted': vals['splitted'], - 'parent_reservation': vals['parent_reservation'], - 'room_name': vals['room_name'], - 'state': vals['state'], - 'only_read': False, - 'fix_days': vals['fix_days'], - 'fix_room': False, - 'overbooking': vals['overbooking'], - 'price_room_services_set': vals['price_room_services_set'], - 'amount_total': vals['pending_amount'] + vals['invoices_paid'], - 'real_dates': vals['real_dates'], - 'channel_type': vals['channel_type'], - }, - 'tooltip': { - 'folio_name': vals['folio_name'], - 'name': vals['partner_name'], - 'phone': vals['partner_phone'], - 'email': vals['partner_email'], - 'room_type_name': vals['room_type_name'], - 'adults': vals['adults'], - 'children': vals['children'], - 'checkin': vals['checkin'], - 'checkout': vals['checkout'], - 'arrival_hour': vals['arrival_hour'], - 'departure_hour': vals['departure_hour'], - 'price_room_services_set': vals['price_room_services_set'], - 'invoices_paid': vals['invoices_paid'], - 'pending_amount': vals['pending_amount'], - 'type': vals['reservation_type'], - 'closure_reason': vals['closure_reason'], - 'out_service_description': vals['out_service_description'], - 'splitted': vals['splitted'], - 'real_dates': vals['real_dates'], - 'channel_type': vals['channel_type'], - 'board_service_name': vals['board_service_name'], - 'services': vals['services'], - } - } - - @api.model - def _generate_pricelist_notification(self, vals): - date_dt = datetime.strptime(vals['date'], DEFAULT_SERVER_DATE_FORMAT) - return { - 'type': 'pricelist', - 'price': { - vals['pricelist_id']: [{ - 'days': { - date_dt.strftime("%d/%m/%Y"): vals['price'], - }, - 'room': vals['room_id'], - 'id': vals['id'], - }], - }, - } - - @api.model - def _generate_restriction_notification(self, vals): - date_dt = datetime.strptime(vals['date'], DEFAULT_SERVER_DATE_FORMAT) - return { - 'type': 'restriction', - 'restriction': { - vals['room_type_id']: { - date_dt.strftime("%d/%m/%Y"): [ - vals['min_stay'], - vals['min_stay_arrival'], - vals['max_stay'], - vals['max_stay_arrival'], - vals['closed'], - vals['closed_arrival'], - vals['closed_departure'], - vals['id'], - ], - }, - }, - } - - @api.model - def send_reservation_notification(self, vals): - notif = self._generate_reservation_notif(vals) - self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation', - HOTEL_BUS_CHANNEL_ID), notif) - - @api.model - def send_pricelist_notification(self, vals): - notif = self._generate_pricelist_notification(vals) - self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation', - HOTEL_BUS_CHANNEL_ID), notif) - - @api.model - def send_restriction_notification(self, vals): - notif = self._generate_restriction_notification(vals) - self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation', - HOTEL_BUS_CHANNEL_ID), notif) diff --git a/hotel_calendar/models/hotel_calendar.py b/hotel_calendar/models/hotel_calendar.py deleted file mode 100644 index 68938f2ff..000000000 --- a/hotel_calendar/models/hotel_calendar.py +++ /dev/null @@ -1,23 +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 HotelCalendar(models.Model): - """ Used to show and filter rooms and reservations in the PMS Calendar. """ - _name = 'hotel.calendar' - - # Default methods - @api.model - def _get_default_hotel(self): - return self.env.user.hotel_id - - # Fields declaration - name = fields.Char('Name', required=True) - hotel_id = fields.Many2one('hotel.property', 'Hotel', required=True, ondelete='restrict', - default=_get_default_hotel) - room_type_ids = fields.Many2many('hotel.room.type', string='Room Type') - segmentation_ids = fields.Many2many('hotel.room.type.class', string='Segmentation') - location_ids = fields.Many2many('hotel.floor', string='Location') - amenity_ids = fields.Many2many('hotel.amenity', string='Amenity') - diff --git a/hotel_calendar/models/hotel_calendar_management.py b/hotel_calendar/models/hotel_calendar_management.py deleted file mode 100644 index afa137340..000000000 --- a/hotel_calendar/models/hotel_calendar_management.py +++ /dev/null @@ -1,277 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging -from datetime import timedelta -from odoo.tools import ( - DEFAULT_SERVER_DATE_FORMAT, - DEFAULT_SERVER_DATETIME_FORMAT) -from odoo import models, api, _, fields -from odoo.exceptions import AccessError, ValidationError -_logger = logging.getLogger(__name__) - - -class HotelCalendarManagement(models.TransientModel): - _name = 'hotel.calendar.management' - - # Business methods - - def get_hcalendar_settings(self): - return { - 'eday_week': self.env.user.hotel_id.pms_end_day_week, - 'eday_week_offset': self.env.user.hotel_id.pms_end_day_week_offset, - 'days': self.env.user.hotel_id.pms_default_num_days, - 'show_notifications': self.env.user.pms_show_notifications, - 'show_num_rooms': self.env.user.hotel_id.pms_show_num_rooms, - } - - @api.model - def _get_prices_values(self, price): - vals = { - 'fixed_price': price['price'], - } - return vals - - @api.model - def _get_restrictions_values(self, restriction): - vals = { - 'min_stay': restriction['min_stay'], - 'min_stay_arrival': restriction['min_stay_arrival'], - 'max_stay': restriction['max_stay'], - 'max_stay_arrival': restriction['max_stay_arrival'], - 'closed': restriction['closed'], - 'closed_arrival': restriction['closed_arrival'], - 'closed_departure': restriction['closed_departure'], - } - return vals - - @api.model - def _hcalendar_room_json_data(self, rooms): - json_data = [] - for room in rooms: - json_data.append({ - 'id': room.id, - 'name': room.name, - 'capacity': room.get_capacity(), - 'price': room.list_price, - 'total_rooms': room.total_rooms_count, - }) - return json_data - - @api.model - def _hcalendar_pricelist_json_data(self, prices): - json_data = {} - room_type_obj = self.env['hotel.room.type'] - for rec in prices: - room_type_id = room_type_obj.search([ - ('product_id.product_tmpl_id', '=', rec.product_tmpl_id.id) - ], limit=1) - if not room_type_id: - continue - - # TODO: date_end - date_start loop - json_data.setdefault(room_type_id.id, []).append({ - 'id': rec.id, - 'price': rec.fixed_price, - 'date': rec.date_start, - }) - return json_data - - @api.model - def _hcalendar_restriction_json_data(self, restrictions): - json_data = {} - for rec in restrictions: - json_data.setdefault(rec.room_type_id.id, []).append({ - 'id': rec.id, - 'date': rec.date, - 'min_stay': rec.min_stay, - 'min_stay_arrival': rec.min_stay_arrival, - 'max_stay': rec.max_stay, - 'max_stay_arrival': rec.max_stay_arrival, - 'closed': rec.closed, - 'closed_departure': rec.closed_departure, - 'closed_arrival': rec.closed_arrival, - }) - return json_data - - @api.model - def _hcalendar_events_json_data(self, dfrom, dto): - date_start = fields.Date.from_string(dfrom) - timedelta(days=1) - date_start_str = date_start.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - user_id = self.env['res.users'].browse(self.env.uid) - domain = [] - if self.env.user.hotel_id.pms_allowed_events_tags: - domain.append(('categ_ids', 'in', self.env.user.hotel_id.pms_allowed_events_tags)) - if self.env.user.hotel_id.pms_denied_events_tags: - domain.append( - ('categ_ids', 'not in', self.env.user.hotel_id.pms_denied_events_tags)) - events_raw = self.env['calendar.event'].search(domain) - events_ll = self.env['calendar.event'].search([ - ('start', '<=', dto), - ('stop', '>=', date_start_str) - ]) - events_lr = self.env['calendar.event'].search([ - ('start', '>=', date_start_str), - ('stop', '<=', dto) - ]) - events = (events_ll | events_lr) & events_raw - json_data = [] - for event in events: - json_data.append([ - event.id, - event.name, - event.start, - event.location, - ]) - return json_data - - @api.model - def _hcalendar_get_count_reservations_json_data(self, dfrom, dto): - date_start = fields.Date.from_string(dfrom) - date_end = fields.Date.from_string(dto) - date_diff = abs((date_end - date_start).days) + 1 - room_type_obj = self.env['hotel.room.type'] - room_types = room_type_obj.search([]) - json_data = {} - - for room_type in room_types: - for i in range(0, date_diff): - cur_date = date_start + timedelta(days=i) - cur_date_str = cur_date.strftime(DEFAULT_SERVER_DATE_FORMAT) - self.env.cr.execute(''' - SELECT - hrl.id - FROM hotel_reservation_line AS hrl - WHERE date = %s - ''', ((cur_date_str),)) - line_ids = [r[0] for r in self.env.cr.fetchall()] - reservation_ids = self.env['hotel.reservation.line'].browse(line_ids).\ - mapped('reservation_id.id') - reservations = self.env['hotel.reservation'].\ - browse(reservation_ids).filtered( - lambda r: r.state != 'cancelled' - and not r.overbooking and not r.reselling - ) - reservations_rooms = reservations.mapped('room_id.id') - free_rooms = self.env['hotel.room'].search([ - ('id', 'not in', reservations_rooms), - ]) - rooms_linked = self.env['hotel.room.type'].search([ - ('id', '=', room_type.id) - ]).room_ids - free_rooms = free_rooms & rooms_linked - json_data.setdefault(room_type.id, []).append({ - 'date': cur_date_str, - 'num': len(free_rooms), - }) - - return json_data - - @api.model - def get_hcalendar_all_data(self, dfrom, dto, pricelist_id, restriction_id, - withRooms): - hotel_id = self.env.user.hotel_id.id - - if not dfrom or not dto: - raise ValidationError(_('Input Error: No dates defined!')) - vals = {} - # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id - if not pricelist_id: - pricelist_id = self.env.user.hotel_id.default_pricelist_id.id - # TODO: refactoring res.config.settings', 'default_restriction_id by the current hotel.property.restriction_id - if not restriction_id: - restriction_id = self.env.user.hotel_id.default_restriction_id.id - - # TODO: ensure pricelist_id and restriction_id belong to the current hotel - vals.update({'pricelist_id': pricelist_id}) - vals.update({'restriction_id': restriction_id}) - - restriction_item_ids = self.env['hotel.room.type.restriction.item'].search([ - ('date', '>=', dfrom), ('date', '<=', dto), - ('restriction_id', '=', restriction_id), - ]) - pricelist_item_ids = self.env['product.pricelist.item'].search([ - ('date_start', '>=', dfrom), ('date_end', '<=', dto), - ('pricelist_id', '=', pricelist_id), - ('applied_on', '=', '1_product'), - ('compute_price', '=', 'fixed'), - ]) - - json_prices = self._hcalendar_pricelist_json_data(pricelist_item_ids) - json_rest = self._hcalendar_restriction_json_data(restriction_item_ids) - # TODO REVIEW: what are json_rc and json_events used for in calendar management ¿? - json_rc = self._hcalendar_get_count_reservations_json_data(dfrom, dto) - json_events = self._hcalendar_events_json_data(dfrom, dto) - vals.update({ - 'prices': json_prices or [], - 'restrictions': json_rest or [], - 'count_reservations': json_rc or [], - 'events': json_events or [], - }) - - if withRooms: - room_ids = self.env['hotel.room.type'].search([ - ('hotel_id', '=', hotel_id) - ], order='sequence ASC') or None - - if not room_ids: - raise AccessError( - _("Wrong hotel and company access settings for this user. " - "No room types found for hotel %s") % self.env.user.hotel_id.name) - - json_rooms = self._hcalendar_room_json_data(room_ids) - vals.update({'rooms': json_rooms or []}) - - return vals - - @api.model - def save_changes(self, pricelist_id, restriction_id, pricelist, - restrictions, availability=False): - room_type_obj = self.env['hotel.room.type'] - product_pricelist_item_obj = self.env['product.pricelist.item'] - room_type_rest_item_obj = self.env['hotel.room.type.restriction.item'] - - # Save Pricelist - for k_price in pricelist.keys(): - room_type_id = room_type_obj.browse([int(k_price)]) - room_type_prod_tmpl_id = room_type_id.product_id.product_tmpl_id - for price in pricelist[k_price]: - price_id = product_pricelist_item_obj.search([ - ('date_start', '>=', price['date']), - ('date_end', '<=', price['date']), - ('pricelist_id', '=', int(pricelist_id)), - ('applied_on', '=', '1_product'), - ('compute_price', '=', 'fixed'), - ('product_tmpl_id', '=', room_type_prod_tmpl_id.id), - ], limit=1) - vals = self._get_prices_values(price) - if not price_id: - vals.update({ - 'date_start': price['date'], - 'date_end': price['date'], - 'pricelist_id': int(pricelist_id), - 'applied_on': '1_product', - 'compute_price': 'fixed', - 'product_tmpl_id': room_type_prod_tmpl_id.id, - }) - price_id = product_pricelist_item_obj.create(vals) - else: - price_id.write(vals) - - # Save Restrictions - for k_res in restrictions.keys(): - for restriction in restrictions[k_res]: - res_id = room_type_rest_item_obj.search([ - ('date', '=', restriction['date']), - ('restriction_id', '=', int(restriction_id)), - ('room_type_id', '=', int(k_res)), - ], limit=1) - vals = self._get_restrictions_values(restriction) - if not res_id: - vals.update({ - 'date': restriction['date'], - 'restriction_id': int(restriction_id), - 'room_type_id': int(k_res), - }) - res_id = room_type_rest_item_obj.create(vals) - else: - res_id.write(vals) diff --git a/hotel_calendar/models/inherited_hotel_folio.py b/hotel_calendar/models/inherited_hotel_folio.py deleted file mode 100644 index 01929f3de..000000000 --- a/hotel_calendar/models/inherited_hotel_folio.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2018-2019 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api, _ - - -class HotelFolio(models.Model): - _inherit = 'hotel.folio' - - # ORM overrides - - def write(self, vals): - ret = super(HotelFolio, self).write(vals) - fields_to_check = ('reservation_ids', 'service_ids', 'pending_amount') - fields_checked = [elm for elm in fields_to_check if elm in vals] - if any(fields_checked): - for record in self: - record.reservation_ids.send_bus_notification('write', 'noshow') - return ret - - - def unlink(self): - for record in self: - record.reservation_ids.send_bus_notification('unlink', 'warn', - _("Folio Deleted")) - return super(HotelFolio, self).unlink() - - # Business methods - - def compute_amount(self): - ret = super(HotelFolio, self).compute_amount() - with self.env.norecompute(): - for record in self: - record.reservation_ids.send_bus_notification('write', 'noshow') - return ret diff --git a/hotel_calendar/models/inherited_hotel_property.py b/hotel_calendar/models/inherited_hotel_property.py deleted file mode 100644 index 77a5093e7..000000000 --- a/hotel_calendar/models/inherited_hotel_property.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2019 Pablo Quesada -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields - - -class HotelProperty(models.Model): - _inherit = 'hotel.property' - - # Fields declaration - pms_show_num_rooms = fields.Integer('Number of rooms to show', - default=0) - pms_divide_rooms_by_capacity = fields.Boolean('Divide rooms by capacity', - default=True) - pms_end_day_week = fields.Selection([ - ('1', 'Monday'), - ('2', 'Tuesday'), - ('3', 'Wednesday'), - ('4', 'Thursday'), - ('5', 'Friday'), - ('6', 'Saturday'), - ('7', 'Sunday') - ], string='Highlight column of day', default='6') - pms_end_day_week_offset = fields.Selection([ - ('0', '0 Days'), - ('1', '1 Days'), - ('2', '2 Days'), - ('3', '3 Days'), - ('4', '4 Days'), - ('5', '5 Days'), - ('6', '6 Days') - ], string='Also illuminate the previous', default='0') - pms_default_num_days = fields.Selection([ - ('month', '1 Month'), - ('21', '3 Weeks'), - ('14', '2 Weeks'), - ('7', '1 Week') - ], string='Default number of days', default='month') - # TODO: review the use of the following option in the calendar js functions - pms_type_move = fields.Selection([ - ('normal', 'Normal'), - ('assisted', 'Assisted'), - ('allow_invalid', 'Allow Invalid') - ], string='Reservation move mode', default='normal') - - pms_allowed_events_tags = fields.Many2many( - 'calendar.event.type', - string="Allow Calendar Event Tags") - pms_denied_events_tags = fields.Many2many( - 'calendar.event.type', - string="Deny Calendar Event Tags") - diff --git a/hotel_calendar/models/inherited_hotel_reservation.py b/hotel_calendar/models/inherited_hotel_reservation.py deleted file mode 100644 index ba48b1b99..000000000 --- a/hotel_calendar/models/inherited_hotel_reservation.py +++ /dev/null @@ -1,521 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging -from datetime import timedelta -from odoo import models, fields, api, _ -from odoo.models import operator -from odoo.exceptions import AccessError, ValidationError -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT -_logger = logging.getLogger(__name__) - - -class HotelReservation(models.Model): - _inherit = 'hotel.reservation' - - # Fields declaration - reserve_color = fields.Char(compute='_compute_color', string='Color', - store=True) - reserve_color_text = fields.Char(compute='_compute_color', string='Color', - store=True) - - # TODO: Add the following method into _compute_color - - def _generate_color(self): - self.ensure_one() - company_id = self.env.user.company_id - if self.reservation_type == 'staff': - reserv_color = company_id.color_staff - reserv_color_text = company_id.color_letter_staff - elif self.reservation_type == 'out': - reserv_color = company_id.color_dontsell - reserv_color_text = company_id.color_letter_dontsell - elif self.to_assign: - reserv_color = company_id.color_to_assign - reserv_color_text = company_id.color_letter_to_assign - elif self.state == 'draft': - reserv_color = company_id.color_pre_reservation - reserv_color_text = company_id.color_letter_pre_reservation - elif self.state == 'confirm': - if self.folio_id.pending_amount <= 0: - reserv_color = company_id.color_reservation_pay - reserv_color_text = company_id.color_letter_reservation_pay - else: - reserv_color = company_id.color_reservation - reserv_color_text = company_id.color_letter_reservation - elif self.state == 'booking': - if self.folio_id.pending_amount <= 0: - reserv_color = company_id.color_stay_pay - reserv_color_text = company_id.color_letter_stay_pay - else: - reserv_color = company_id.color_stay - reserv_color_text = company_id.color_letter_stay - else: - if self.folio_id.pending_amount <= 0: - reserv_color = company_id.color_checkout - reserv_color_text = company_id.color_letter_checkout - else: - reserv_color = company_id.color_payment_pending - reserv_color_text = company_id.color_letter_payment_pending - return reserv_color, reserv_color_text - - # Constraints and onchanges - @api.depends('state', 'reservation_type', 'folio_id.pending_amount', 'to_assign') - def _compute_color(self): - for record in self: - colors = record._generate_color() - record.update({ - 'reserve_color': colors[0], - 'reserve_color_text': colors[1], - }) - - # ORM overrides - @api.model - def create(self, vals): - reservation_id = super(HotelReservation, self).create(vals) - reservation_id.send_bus_notification('create', - 'notify', - _("Reservation Created")) - return reservation_id - - - def write(self, vals): - _logger.info("RESERV WRITE") - ret = super(HotelReservation, self).write(vals) - self.send_bus_notification('write', 'noshow') - return ret - - - def unlink(self): - self.send_bus_notification('unlink', - 'warn', - _("Reservation Deleted")) - return super(HotelReservation, self).unlink() - - # Business methods - @api.model - def _hcalendar_room_data(self, rooms): - _logger.warning('_found [%s] rooms for hotel [%s]', len(rooms), self.env.user.hotel_id.id) - # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id - pricelist_id = self.env.user.hotel_id.default_pricelist_id.id - json_rooms = [ - { - 'id': room.id, - 'name': room.name, - 'capacity': room.capacity, - 'class_name': room.room_type_id.class_id.name, - 'class_id': room.room_type_id.class_id.id, - 'shared_id': room.shared_room_id, - 'price': room.room_type_id - and ['pricelist', room.room_type_id.id, pricelist_id, - room.room_type_id.name] or 0, - 'room_type_name': room.room_type_id.name, - 'room_type_id': room.room_type_id.id, - 'floor_id': room.floor_id.id, - 'amentity_ids': room.room_type_id.room_amenity_ids.ids, - } for room in rooms] - return json_rooms - - @api.model - def _hcalendar_reservation_data(self, reservations): - _logger.warning('_found [%s] reservations for hotel [%s]', len(reservations), self.env.user.hotel_id.id) - json_reservations = [] - json_reservation_tooltips = {} - for reserv in reservations: - json_reservations.append({ - 'room_id': reserv['room_id'], - 'id': reserv['id'], - 'name': reserv['closure_reason'] or _('Out of service') - if reserv['reservation_type'] == 'out' - else reserv['partner_name'], - 'adults': reserv['adults'], - 'childrens': reserv['children'], - 'checkin': reserv['checkin'], - 'checkout': reserv['checkout'], - 'folio_id': reserv['folio_id'], - 'bgcolor': reserv['reserve_color'], - 'color': reserv['reserve_color_text'], - 'splitted': reserv['splitted'], - 'parent_reservation': reserv['parent_reservation'] or False, - 'read_only': False, # Read-Only - 'fix_days': reserv['splitted'], # Fix Days - 'fix_room': False, # Fix Rooms - 'overbooking': reserv['overbooking'], - 'state': reserv['state'], - 'price_room_services_set': reserv['price_room_services_set'], - 'amount_total': reserv['amount_total'], - 'real_dates': [reserv['real_checkin'], reserv['real_checkout']], - 'channel_type': reserv['channel_type'], - }) - json_reservation_tooltips.update({ - reserv['id']: { - 'folio_name': reserv['folio_name'], - 'name': _('Out of service') - if reserv['reservation_type'] == 'out' - else reserv['partner_name'], - 'phone': reserv['mobile'] or reserv['phone'] - or _('Phone not provided'), - 'email': reserv['email'] or _('Email not provided'), - 'room_type_name': reserv['room_type'], - 'adults': reserv['adults'], - 'children': reserv['children'], - 'checkin': reserv['checkin'], - 'checkout': reserv['checkout'], - 'arrival_hour': reserv['arrival_hour'], - 'departure_hour': reserv['departure_hour'], - 'price_room_services_set': reserv['price_room_services_set'], - 'invoices_paid': reserv['invoices_paid'], - 'pending_amount': reserv['pending_amount'], - 'type': reserv['reservation_type'] or 'normal', - 'closure_reason': reserv['closure_reason'], - 'out_service_description': reserv['out_service_description'] - or _('No reason given'), - 'splitted': reserv['splitted'], - 'channel_type': reserv['channel_type'], - 'real_dates': [reserv['real_checkin'], reserv['real_checkout']], - 'board_service_name': reserv['board_service_name'] or _('No board services'), - 'services': reserv['services'], - } - }) - return json_reservations, json_reservation_tooltips - - @api.model - def _hcalendar_event_data(self, events): - # TODO: Filter events by hotel - json_events = [ - { - 'id': event.id, - 'name': event.name, - 'date': event.start, - 'location': event.location, - } for event in events] - return json_events - - @api.model - def _hcalendar_calendar_data(self, calendars): - _logger.warning('_found [%s] calendars for hotel [%s]', len(calendars), self.env.user.hotel_id.id) - return [ - { - 'id': calendar.id, - 'name': calendar.name, - 'segmentation_ids': calendar.segmentation_ids.ids, - 'location_ids': calendar.location_ids.ids, - 'amenity_ids': calendar.amenity_ids.ids, - 'room_type_ids': calendar.room_type_ids.ids, - } for calendar in calendars] - - @api.model - def get_hcalendar_reservations_data(self, dfrom_dt, dto_dt, rooms): - rdfrom_dt = dfrom_dt + timedelta(days=1) # Ignore checkout - rdfrom_str = rdfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - dto_str = dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - self.env.cr.execute(''' - 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.price_room_services_set, - - hf.id as folio_id, hf.name as folio_name, hf.reservation_type, hf.invoices_paid, hf.pending_amount, - hf.amount_total, - - 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 - LEFT JOIN hotel_room_type AS hrt ON hr.room_type_id = hrt.id - LEFT JOIN product_product AS pp ON hrt.product_id = pp.id - LEFT JOIN product_template AS pt ON pp.product_tmpl_id = pt.id - LEFT JOIN res_partner AS rp ON hf.partner_id = rp.id - LEFT JOIN room_closure_reason as rcr - ON hf.closure_reason_id = rcr.id - LEFT JOIN hotel_board_service_room_type_rel AS hbsrt ON hr.board_service_room_id = hbsrt.id - LEFT JOIN hotel_board_service AS hbs ON hbsrt.hotel_board_service_id = hbs.id - LEFT JOIN hotel_service AS hs ON hr.id = hs.reservation_id - LEFT JOIN product_product AS pp2 ON hs.product_id = pp2.id - LEFT JOIN product_template AS pt2 ON pp2.product_tmpl_id = pt2.id - WHERE room_id IN %s AND ( - (checkin <= %s AND checkout >= %s AND checkout <= %s) - OR (checkin >= %s AND checkout <= %s) - OR (checkin >= %s AND checkin <= %s AND checkout >= %s) - OR (checkin <= %s AND checkout >= %s)) - GROUP BY hr.id, hf.id, pt.name, rcr.name, hbs.name, rp.mobile, rp.phone, rp.email, rp.name - ORDER BY checkin DESC, checkout ASC, adults DESC, children DESC - ''', (tuple(rooms.ids), - rdfrom_str, rdfrom_str, dto_str, - rdfrom_str, dto_str, - rdfrom_str, dto_str, dto_str, - rdfrom_str, dto_str)) - return self._hcalendar_reservation_data(self.env.cr.dictfetchall()) - - @api.model - def get_hcalendar_pricelist_data(self, dfrom_dt, dto_dt): - # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id - pricelist_id = self.env.user.hotel_id.default_pricelist_id.id - hotel_id = self.env.user.hotel_id.id - room_types_ids = self.env['hotel.room.type'].search([ - ('hotel_id', '=', hotel_id) - ]) - - dfrom_str = dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - dto_str = dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - - self.env.cr.execute(''' - WITH RECURSIVE gen_table_days AS ( - SELECT hrt.id, %s::Date AS date, hrt.sequence - FROM hotel_room_type AS hrt - UNION ALL - SELECT hrt.id, (td.date + INTERVAL '1 day')::Date, hrt.sequence - FROM gen_table_days as td - LEFT JOIN hotel_room_type AS hrt ON hrt.id=td.id - WHERE td.date < %s - ) - SELECT - TO_CHAR(gtd.date, 'DD/MM/YYYY') as date, gtd.id as room_type_id, gtd.sequence, - pt.name, ppi.fixed_price as price, pt.list_price - FROM gen_table_days AS gtd - LEFT JOIN hotel_room_type AS hrt ON hrt.id = gtd.id - LEFT JOIN product_product AS pp ON pp.id = hrt.product_id - LEFT JOIN product_template AS pt ON pt.id = pp.product_tmpl_id - LEFT JOIN product_pricelist_item AS ppi ON ppi.date_start = gtd.date AND ppi.date_end = gtd.date AND ppi.product_tmpl_id = pt.id - WHERE gtd.id IN %s - ORDER BY gtd.id ASC, gtd.date ASC - ''', (dfrom_str, dto_str, tuple(room_types_ids.ids))) - query_results = self.env.cr.dictfetchall() - - json_data = {} - for results in query_results: - if results['room_type_id'] not in json_data: - json_data.setdefault(results['room_type_id'], {}).update({ - 'title': results['name'], - 'room': results['room_type_id'], - 'sequence': results['sequence'], - }) - json_data[results['room_type_id']].setdefault('days', {}).update({ - results['date']: results['price'] or results['list_price'] - }) - - json_data_by_sequence = list(json_data.values()) - json_data_by_sequence.sort(key=operator.itemgetter('sequence')) - - json_rooms_prices = {} - for prices in json_data_by_sequence: - json_rooms_prices.setdefault(pricelist_id, []).append(prices) - return json_rooms_prices - - @api.model - def get_hcalendar_restrictions_data(self, dfrom_dt, dto_dt): - """ Returns the room type restrictions between dfrom_dt and dto_dt - for the room types of the current_hotel within the default restriction plan - """ - hotel_id = self.env.user.hotel_id.id - restriction_id = self.env.user.hotel_id.default_restriction_id.id - - json_rooms_rests = {} - room_typed_ids = self.env['hotel.room.type'].search([ - ('hotel_id', '=', hotel_id) - ], order='sequence ASC') - - room_type_rest_obj = self.env['hotel.room.type.restriction.item'] - rtype_rest_ids = room_type_rest_obj.search([ - ('room_type_id', 'in', room_typed_ids.ids), - ('date', '>=', dfrom_dt), - ('date', '<=', dto_dt), - ('restriction_id', '=', restriction_id) - ]) - - for room_type in room_typed_ids: - days = {} - rest_ids = rtype_rest_ids.filtered( - lambda x: x.room_type_id == room_type) - for rest_id in rest_ids: - days.update({ - fields.Date.from_string(rest_id.date).strftime("%d/%m/%Y"): ( - rest_id.min_stay, - rest_id.min_stay_arrival, - rest_id.max_stay, - rest_id.max_stay_arrival, - rest_id.closed, - rest_id.closed_arrival, - rest_id.closed_departure) - }) - json_rooms_rests.update({room_type.id: days}) - return json_rooms_rests - - @api.model - def get_hcalendar_events_data(self, dfrom_dt, dto_dt): - user_id = self.env['res.users'].browse(self.env.uid) - domain = [ - '|', '&', - ('start', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), - ('stop', '>=', dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), - '&', - ('start', '>=', dfrom_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)), - ('stop', '<=', dto_dt.strftime(DEFAULT_SERVER_DATE_FORMAT)) - ] - if self.env.user.hotel_id.pms_allowed_events_tags: - domain.append(('categ_ids', 'in', self.env.user.hotel_id.pms_allowed_events_tags)) - if self.env.user.hotel_id.pms_denied_events_tags: - domain.append( - ('categ_ids', 'not in', self.env.user.hotel_id.pms_denied_events_tags)) - events_raw = self.env['calendar.event'].search(domain) - return self._hcalendar_event_data(events_raw) - - @api.model - def get_hcalendar_calendar_data(self): - hotel_id = self.env.user.hotel_id.id - calendars = self.env['hotel.calendar'].search([ - ('hotel_id', '=', hotel_id) - ]) - res = self._hcalendar_calendar_data(calendars) - return res - - @api.model - def get_hcalendar_all_data(self, dfrom, dto, withRooms=True): - if not dfrom or not dto: - raise ValidationError(_('Input Error: No dates defined!')) - - hotel_id = self.env.user.hotel_id.id - - dfrom_dt = fields.Date.from_string(dfrom) - dto_dt = fields.Date.from_string(dto) - - rooms = self.env['hotel.room'].search([ - ('hotel_id', '=', hotel_id) - ], order='sequence ASC') or None - - if not rooms: - raise AccessError( - _("No rooms found for hotel %s. " - "Please, review the rooms configured for this hotel.") % self.env.user.hotel_id.name) - - json_res, json_res_tooltips = self.get_hcalendar_reservations_data( - dfrom_dt, dto_dt, rooms) - - vals = { - 'rooms': withRooms and self._hcalendar_room_data(rooms) or [], - 'reservations': json_res, - 'tooltips': json_res_tooltips, - 'pricelist': self.get_hcalendar_pricelist_data(dfrom_dt, dto_dt), - 'restrictions': self.get_hcalendar_restrictions_data(dfrom_dt, - dto_dt), - 'events': self.get_hcalendar_events_data(dfrom_dt, dto_dt), - 'calendars': withRooms and self.get_hcalendar_calendar_data() - or [] - } - return vals - - @api.model - def get_hcalendar_settings(self): - type_move = self.env.user.hotel_id.pms_type_move - return { - 'divide_rooms_by_capacity': self.env.user.hotel_id.pms_divide_rooms_by_capacity, - 'eday_week': self.env.user.hotel_id.pms_end_day_week, - 'eday_week_offset': self.env.user.hotel_id.pms_end_day_week_offset, - 'days': self.env.user.hotel_id.pms_default_num_days, - 'allow_invalid_actions': type_move == 'allow_invalid', - 'assisted_movement': type_move == 'assisted', - 'default_arrival_hour': self.env.user.hotel_id.default_arrival_hour, - 'default_departure_hour': self.env.user.hotel_id.default_departure_hour, - 'show_notifications': self.env.user.pms_show_notifications, - 'show_pricelist': self.env.user.pms_show_pricelist, - 'show_availability': self.env.user.pms_show_availability, - 'show_num_rooms': self.env.user.hotel_id.pms_show_num_rooms, - } - - - def generate_bus_values(self, naction, ntype, ntitle=''): - self.ensure_one() - return { - 'action': naction, - 'type': ntype, - 'title': ntitle, - 'room_id': self.room_id.id, - 'reserv_id': self.id, - 'folio_name': self.folio_id.name, - 'partner_name': (self.closure_reason_id.name or _('Out of service')) - if self.reservation_type == 'out' else self.partner_id.name, - 'adults': self.adults, - 'children': self.children, - 'checkin': self.checkin, - 'checkout': self.checkout, - 'arrival_hour': self.arrival_hour, - 'departure_hour': self.departure_hour, - 'folio_id': self.folio_id.id, - 'reserve_color': self.reserve_color, - 'reserve_color_text': self.reserve_color_text, - 'splitted': self.splitted, - 'parent_reservation': self.parent_reservation - and self.parent_reservation.id or 0, - 'room_name': self.room_id.name, - 'room_type_name': self.room_type_id.name, - 'partner_phone': self.partner_id.mobile - or self.partner_id.phone or _('Undefined'), - 'partner_email': self.partner_id.email or _('Undefined'), - 'state': self.state, - 'fix_days': self.splitted, - 'overbooking': self.overbooking, - 'price_room_services_set': self.price_room_services_set, - 'invoices_paid': self.folio_id.invoices_paid, - 'pending_amount': self.folio_id.pending_amount, - 'reservation_type': self.reservation_type or 'normal', - 'closure_reason': self.closure_reason_id.name, - 'out_service_description': self.out_service_description - or _('No reason given'), - 'real_dates': [self.real_checkin, self.real_checkout], - 'channel_type': self.channel_type, - 'board_service_name': self.board_service_room_id.hotel_board_service_id.name or _('No board services'), - 'services': [service.product_id.name for service in self.service_ids - if service.product_id.show_in_calendar] or False, - } - - - def send_bus_notification(self, naction, ntype, ntitle=''): - hotel_cal_obj = self.env['bus.hotel.calendar'] - for record in self: - if not isinstance(record.id, models.NewId) \ - and not isinstance(record.folio_id.id, models.NewId) \ - and not isinstance(record.partner_id.id, models.NewId): - hotel_cal_obj.send_reservation_notification( - record.generate_bus_values(naction, ntype, ntitle)) - - @api.model - def swap_reservations(self, fromReservsIds, toReservsIds): - from_reservs = self.env['hotel.reservation'].browse(fromReservsIds) - to_reservs = self.env['hotel.reservation'].browse(toReservsIds) - - if not any(from_reservs) or not any(to_reservs): - raise ValidationError(_("Invalid swap parameters")) - - max_from_persons = max( - from_reservs.mapped(lambda x: x.adults)) - max_to_persons = max( - to_reservs.mapped(lambda x: x.adults)) - - from_room = from_reservs[0].room_id - to_room = to_reservs[0].room_id - from_overbooking = from_reservs[0].overbooking - to_overbooking = to_reservs[0].overbooking - - if max_from_persons > to_room.capacity or \ - max_to_persons > from_room.capacity: - raise ValidationError("Invalid swap operation: wrong capacity") - - for record in from_reservs: - record.with_context({'ignore_avail_restrictions': True}).write({ - 'room_id': to_room.id, - 'overbooking': to_overbooking, - }) - for record in to_reservs: - record.with_context({'ignore_avail_restrictions': True}).write({ - 'room_id': from_room.id, - 'overbooking': from_overbooking, - }) - - return True diff --git a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py b/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py deleted file mode 100644 index d24cc7b5c..000000000 --- a/hotel_calendar/models/inherited_hotel_room_type_restriction_item.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging -from odoo import models, api -_logger = logging.getLogger(__name__) - - -class HotelRoomTypeRestrictionItem(models.Model): - _inherit = 'hotel.room.type.restriction.item' - - # ORM overrides - @api.model - def create(self, vals): - res = super(HotelRoomTypeRestrictionItem, self).create(vals) - if res.restriction_id.id == self.env.user.hotel_id.default_restriction_id.id: - self.env['bus.hotel.calendar'].send_restriction_notification({ - '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 - - - def write(self, vals): - ret_vals = super(HotelRoomTypeRestrictionItem, self).write(vals) - bus_hotel_calendar_obj = self.env['bus.hotel.calendar'] - for record in self: - bus_hotel_calendar_obj.send_restriction_notification({ - 'restriction_id': record.restriction_id.id, - 'date': record.date, - 'min_stay': record.min_stay, - 'min_stay_arrival': record.min_stay_arrival, - 'max_stay': record.max_stay, - 'max_stay_arrival': record.max_stay_arrival, - 'closed': record.closed, - 'closed_departure': record.closed_departure, - 'closed_arrival': record.closed_arrival, - 'room_type_id': record.room_type_id.id, - 'id': record.id, - }) - return ret_vals - - - def unlink(self): - default_restriction_id = self.env.user.hotel_id.default_restriction_id.id - # Construct dictionary with relevant info of removed records - unlink_vals = [] - for record in self: - if record.restriction_id.id != default_restriction_id: - continue - unlink_vals.append({ - 'restriction_id': record.restriction_id.id, - 'date': record.date, - 'min_stay': 0, - 'min_stay_arrival': 0, - 'max_stay': 0, - 'max_stay_arrival': 0, - 'closed': False, - 'closed_departure': False, - 'closed_arrival': False, - 'room_type_id': record.room_type_id.id, - 'id': record.id, - }) - res = super(HotelRoomTypeRestrictionItem, self).unlink() - bus_hotel_calendar_obj = self.env['bus.hotel.calendar'] - for uval in unlink_vals: - bus_hotel_calendar_obj.send_restriction_notification(uval) - return res diff --git a/hotel_calendar/models/inherited_product_pricelist_item.py b/hotel_calendar/models/inherited_product_pricelist_item.py deleted file mode 100644 index e55cb0cb8..000000000 --- a/hotel_calendar/models/inherited_product_pricelist_item.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api - - -class ProductPricelistItem(models.Model): - _inherit = 'product.pricelist.item' - - # ORM overrides - @api.model - def create(self, vals): - res = super(ProductPricelistItem, self).create(vals) - # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id - pricelist_default_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_pricelist_id') - if pricelist_default_id: - pricelist_default_id = int(pricelist_default_id) - pricelist_id = res.pricelist_id.id - product_tmpl_id = res.product_tmpl_id.id - date_start = res.date_start - room_type = self.env['hotel.room.type'].search([ - ('product_id.product_tmpl_id', '=', product_tmpl_id) - ], limit=1) - if pricelist_id == pricelist_default_id and room_type: - prod = room_type.product_id.with_context( - quantity=1, - date=date_start, - pricelist=pricelist_id) - prod_price = prod.price - - self.env['bus.hotel.calendar'].send_pricelist_notification({ - 'pricelist_id': pricelist_id, - 'date': date_start, - 'room_id': room_type.id, - 'price': prod_price, - 'id': self.id, - }) - return res - - - def write(self, vals): - # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id - pricelist_default_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_pricelist_id') - if pricelist_default_id: - pricelist_default_id = int(pricelist_default_id) - ret_vals = super(ProductPricelistItem, self).write(vals) - - bus_calendar_obj = self.env['bus.hotel.calendar'] - room_type_obj = self.env['hotel.room.type'] - if vals.get('fixed_price'): - for record in self: - pricelist_id = vals.get('pricelist_id') or \ - record.pricelist_id.id - if pricelist_id != pricelist_default_id: - continue - date_start = vals.get('date_start') or record.date_start - product_tmpl_id = vals.get('product_tmpl_id') or \ - record.product_tmpl_id.id - room_type = room_type_obj.search([ - ('product_id.product_tmpl_id', '=', product_tmpl_id) - ], limit=1) - - if room_type and date_start: - prod = room_type.product_id.with_context( - quantity=1, - date=date_start, - pricelist=pricelist_id) - prod_price = prod.price - - bus_calendar_obj.send_pricelist_notification({ - 'pricelist_id': pricelist_id, - 'date': date_start, - 'room_id': room_type.id, - 'price': prod_price, - 'id': record.id, - }) - return ret_vals - - - def unlink(self): - # TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id - pricelist_default_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_pricelist_id') - if pricelist_default_id: - pricelist_default_id = int(pricelist_default_id) - # Construct dictionary with relevant info of removed records - unlink_vals = [] - for record in self: - if record.pricelist_id.id != pricelist_default_id: - continue - room_type = self.env['hotel.room.type'].search([ - ('product_id.product_tmpl_id', '=', record.product_tmpl_id.id) - ], limit=1) - unlink_vals.append({ - 'pricelist_id': record.pricelist_id.id, - 'date': record.date_start, - 'room': room_type, - 'id': record.id, - }) - # Do Normal Stuff - res = super(ProductPricelistItem, self).unlink() - # Do extra operations - bus_calendar_obj = self.env['bus.hotel.calendar'] - for vals in unlink_vals: - pricelist_id = vals['pricelist_id'] - date_start = vals['date'] - room_type = vals['room'] - prod = room_type.product_id.with_context( - quantity=1, - date=date_start, - pricelist=pricelist_id) - - # Send Notification to update calendar pricelist - bus_calendar_obj.send_pricelist_notification({ - 'pricelist_id': pricelist_id, - 'date': date_start, - 'room_id': room_type.id, - 'price': prod.price, - 'id': vals['id'], - }) - return res diff --git a/hotel_calendar/models/inherited_res_company.py b/hotel_calendar/models/inherited_res_company.py deleted file mode 100644 index 34dcf8068..000000000 --- a/hotel_calendar/models/inherited_res_company.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2019 Pablo Quesada -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields - - -class ResCompany(models.Model): - _inherit = 'res.company' - - # Fields declaration - color_pre_reservation = fields.Char('Pre-reservation', default='#A24680') - color_reservation = fields.Char('Confirmed Reservation ', default='#7C7BAD') - color_reservation_pay = fields.Char('Paid Reservation', default='#584D76') - color_stay = fields.Char('Checkin', default='#FF4040') - color_stay_pay = fields.Char('Paid Checkin', default='#82BF07') - color_checkout = fields.Char('Checkout', default='#7E7E7E') - color_dontsell = fields.Char('Dont Sell', default='#000000') - color_staff = fields.Char('Staff', default='#C08686') - color_to_assign = fields.Char('Ota Reservation to Assign', default='#ED722E') - color_payment_pending = fields.Char('Payment Pending', default='#A24689') - color_letter_pre_reservation = fields.Char('Letter Pre-reservation', default='#FFFFFF') - color_letter_reservation = fields.Char('Letter Confirmed Reservation ', default='#FFFFFF') - color_letter_reservation_pay = fields.Char('Letter Paid Reservation', default='#FFFFFF') - color_letter_stay = fields.Char('Letter Checkin', default='#FFFFFF') - color_letter_stay_pay = fields.Char('Letter Stay Pay', default='#FFFFFF') - color_letter_checkout = fields.Char('Letter Checkout', default='#FFFFFF') - color_letter_dontsell = fields.Char('Letter Dont Sell', default='#FFFFFF') - color_letter_staff = fields.Char('Letter Staff', default='#FFFFFF') - color_letter_to_assign = fields.Char('Letter Ota to Assign', default='#FFFFFF') - color_letter_payment_pending = fields.Char('Letter Payment Pending', default='#FFFFFF') diff --git a/hotel_calendar/models/inherited_res_users.py b/hotel_calendar/models/inherited_res_users.py deleted file mode 100644 index 55725cf5b..000000000 --- a/hotel_calendar/models/inherited_res_users.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields - - -class ResUsers(models.Model): - _inherit = 'res.users' - - # Fields declaration - pms_show_notifications = fields.Boolean('Show Notifications', default=True) - pms_show_pricelist = fields.Boolean('Show Pricelist', default=True) - pms_show_availability = fields.Boolean('Show Availability', default=True) - - # ORM overrides - def __init__(self, pool, cr): - """ Override of __init__ to add access rights. - Access rights are disabled by default, but allowed on some specific - fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS. - """ - super(ResUsers, self).__init__(pool, cr) - # duplicate list to avoid modifying the original reference - type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) - type(self).SELF_WRITEABLE_FIELDS.extend([ - 'pms_show_notifications', - 'pms_show_pricelist', - 'pms_show_availability', - ]) - # duplicate list to avoid modifying the original reference - type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) - type(self).SELF_READABLE_FIELDS.extend([ - 'pms_show_notifications', - 'pms_show_pricelist', - 'pms_show_availability', - ]) diff --git a/hotel_calendar/models/ir_actions_act_window_view.py b/hotel_calendar/models/ir_actions_act_window_view.py deleted file mode 100644 index 44022e3dc..000000000 --- a/hotel_calendar/models/ir_actions_act_window_view.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields - - -class ActWindowView(models.Model): - _inherit = 'ir.actions.act_window.view' - - # Fields declaration - view_mode = fields.Selection(selection_add=[('pms', "PMS"), ('mpms', 'Management PMS')]) diff --git a/hotel_calendar/models/ir_ui_view.py b/hotel_calendar/models/ir_ui_view.py deleted file mode 100644 index e878c9d6e..000000000 --- a/hotel_calendar/models/ir_ui_view.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields - - -class View(models.Model): - _inherit = 'ir.ui.view' - - # Fields declaration - type = fields.Selection(selection_add=[('pms', "PMS"), ('mpms', 'Management PMS')]) diff --git a/hotel_calendar/readme/CONFIGURE.rst b/hotel_calendar/readme/CONFIGURE.rst deleted file mode 100644 index a3c81f46a..000000000 --- a/hotel_calendar/readme/CONFIGURE.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. [ This file is optional, it should explain how to configure -the module before using it; it is aimed at advanced users. ] - -No action required. The module is pre-configured with default values. - -You will find the hotel calendar settings in `Settings > Users & Companies > Hotels > Your Hotel > Calendar Settings Tab`. - -Reservation colors can be configured by company in `Settings > Users & Companies > Companies > Your Company > Hotel Preferences Tab.` \ No newline at end of file diff --git a/hotel_calendar/readme/CONTRIBUTORS.rst b/hotel_calendar/readme/CONTRIBUTORS.rst deleted file mode 100644 index c0ca43ca9..000000000 --- a/hotel_calendar/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,2 +0,0 @@ -# authors are taken from the __manifest__.py file -* Pablo Quesada \ No newline at end of file diff --git a/hotel_calendar/readme/CREDITS.rst b/hotel_calendar/readme/CREDITS.rst deleted file mode 100644 index 61d2f78cc..000000000 --- a/hotel_calendar/readme/CREDITS.rst +++ /dev/null @@ -1,2 +0,0 @@ -.. [ This file is optional and contains additional credits, other than -authors, contributors, and maintainers. ] \ No newline at end of file diff --git a/hotel_calendar/readme/DESCRIPTION.rst b/hotel_calendar/readme/DESCRIPTION.rst deleted file mode 100644 index a44f8af2a..000000000 --- a/hotel_calendar/readme/DESCRIPTION.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. [ This file must be max 2-3 paragraphs, and is required. ] - -This module extends the functionality of roomdoo. - -The calendar displays your rooms in a range of dates. -The rooms can be filtered by class, type or even amenities creating new calendars for easily manage all your reservations. -You can manage prices and restrictions day by day using the calendar management view. - -This module adds two new view types: ``pms`` and ``mpms``. -The module also incorporates a longpolling for delivering instant notification when using the calendar. \ No newline at end of file diff --git a/hotel_calendar/readme/INSTALL.rst b/hotel_calendar/readme/INSTALL.rst deleted file mode 100644 index 96fe22619..000000000 --- a/hotel_calendar/readme/INSTALL.rst +++ /dev/null @@ -1,5 +0,0 @@ -.. [ This file must only be present if there are very specific -installation instructions, such as installing non-python dependencies. The audience is systems administrators. ] - -This module depends on modules ``hotel``, ``bus``, ``web``, ``calendar``, and ``web_widget_color``. -Ensure yourself to have all them in your addons list. \ No newline at end of file diff --git a/hotel_calendar/readme/ROADMAP.rst b/hotel_calendar/readme/ROADMAP.rst deleted file mode 100644 index 3f8c38c78..000000000 --- a/hotel_calendar/readme/ROADMAP.rst +++ /dev/null @@ -1,5 +0,0 @@ -.. [ Enumerate known caveats and future potential improvements. -It is mostly intended for end-users, and can also help potential new contributors discovering new features to implement. ] - -- [ ] Implement the calendar view as an Odoo native view type. -- [ ] Re-design the calendar using SVG or other Odoo native approach. \ No newline at end of file diff --git a/hotel_calendar/readme/USAGE.rst b/hotel_calendar/readme/USAGE.rst deleted file mode 100644 index e704b7dd3..000000000 --- a/hotel_calendar/readme/USAGE.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. [ This file must be present and contains the usage instructions -for end-users. As all other rst files included in the README, it MUST NOT contain reStructuredText sections -only body text (paragraphs, lists, tables, etc). Should you need a more elaborate structure to explain the addon, -please create a Sphinx documentation (which may include this file as a "quick start" section). ] - -To use this module, you need to: - -* Go to Hotel Calendar menu for managing reservations. -* Go to Hotel Calendar Management for managing prices and restrictions. -* Go to Hotel Management/Configuration/Calendars menu for managing calendar tabs. - -Shortcuts -* `CTRL + LEFT MOUSE CLICK`` on a reservation - Start reservation swap -* ``ESC`` - cancel active action (ie. swap) diff --git a/hotel_calendar/security/ir.model.access.csv b/hotel_calendar/security/ir.model.access.csv deleted file mode 100644 index c8305754e..000000000 --- a/hotel_calendar/security/ir.model.access.csv +++ /dev/null @@ -1,4 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_hotel_product_pricelist_item_call,hotel_calendar.pricelist_item_call,hotel_calendar.model_product_pricelist_item,hotel.group_hotel_call,1,1,1,1 -access_hotel_product_pricelist_item_user,hotel_calendar.pricelist_item_use,hotel_calendar.model_product_pricelist_item,hotel.group_hotel_user,1,1,1,1 -access_hotel_calendar,access_hotel_calendar,model_hotel_calendar,base.group_user,1,0,0,0 diff --git a/hotel_calendar/static/description/icon.png b/hotel_calendar/static/description/icon.png deleted file mode 100644 index 45ab4dc29..000000000 Binary files a/hotel_calendar/static/description/icon.png and /dev/null differ diff --git a/hotel_calendar/static/description/icon_calendar_configurator.png b/hotel_calendar/static/description/icon_calendar_configurator.png deleted file mode 100644 index bce8eb8f1..000000000 Binary files a/hotel_calendar/static/description/icon_calendar_configurator.png and /dev/null differ diff --git a/hotel_calendar/static/src/css/view.css b/hotel_calendar/static/src/css/view.css deleted file mode 100644 index 3546bf6bf..000000000 --- a/hotel_calendar/static/src/css/view.css +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Hotel Calendar JS v0.0.1a - 2017 - * GNU Public License - * Aloxa Solucions S.L. - * Alexandre Díaz - */ - - -/* .openerp .oe-view-manager { - overflow: initial !important; -} - */ - -.o_hotel_calendar_view { - display: flex; - height: 100%; -} - -.nopadding { - padding: 0 !important; - margin: 0 !important; -} - - - -#pms-menu { - overflow: auto; - background-color: #f8f8f8; - height: 100%; - padding: 0 2.5em; -} - -#pms-menu .input-group span, #pms-menu input { - border-radius: 0; -} - -#pms-menu button { - border-radius: 0; - border: 1px solid lightgray; - font-size: x-small; -} - -#pms-calendar: { - flex: 1 1 auto; - overflow: auto; -} - -#pms-search { - position: fixed; - z-index: 9; -} - -#hcal_widget { - max-height: 100%; -} - -#multicalendar_panels { - background-color: white; - border-left: 1px solid #ddd; -} - -.nav-tabs > li > a { - border-radius: 0; -} - -.nav-tabs { - padding-top: 4px; -} - -/* BUTTON STATES */ -.navbar-default { - border-color: #f8f8f8; -} - - -.unify-enabled { - background-color: #43A200; - color: white; -} - -.divide-enabled { - background-color: #43A200; - color: white; -} - -.overbooking-enabled { - background-color: #43A200; - color: white; -} - -.cancelled-enabled { - background-color: #43A200; -} - -.swap-from { - background-color: #E7CF1D; - color: #7C7BAD; -} - -.swap-to { - background-color: #43A200; - color: white; -} - -.unify-enabled i, .divide-enabled i, .cancelled-enabled i, .overbooking-enabled i, .swap-to i { - color: white; -} - -.swap-from i { - color: #7C7BAD; -} - -/* END: BUTTON STATES */ - -input#bookings_search { - border-top-left-radius: 0; - border-top-right-radius: 0; - border: 1px solid lightgray; -} - -#pms-menu .menu-date-box { - margin-top: 2px !important; -} - -#pms-menu .menu-button-box, #pms-menu .menu-search-box, #pms-menu .menu-filter-box { - margin-top: 1em !important; -} - -#pms-menu .menu-filter-box .filter-record { - margin-top: 1em; -} - -#pms-menu .menu-filter-box h4 { - cursor: pointer; -} -#pms-menu .menu-filter-box h4 i { - transition: all 0.5s ease; -} - -#pms-menu .button-box { - text-align: left; - min-height: 3.5em; - padding: 3px; - transition: all 0.5s ease; - overflow: hidden; -} - -.overbooking-highlight { - color: white; - background-color: #FFA500; -} - -.overbooking-highlight i { - color: white; -} - -.multi-calendar-tab-plus { - background-color: darkgray; - font-weight: bold; - color: white; -} - -#pms-menu div[id^=btn_] { - padding: 2px; -} - -.warn-message { - text-align: center; - line-height: 100vh; - font-size: xx-large; - color: gray; -} - -/** SELECT 2 **/ -#pms-menu .select2-container, #pms-menu .select2-choice { - border-radius: 0; -} -#pms-menu .select2-choice { - height: 100%; - padding: 2px; -} - -/** BOOTSTRAP **/ -.badge-danger { - background-color: #d34f2a !important; -} - -/** ODOO **/ -.o_chat_window { - z-index: 8 !important; -} - -.o_button_icon { - display: inline-block; - width: 37px; - padding: 0px 3px; - text-align: center; - vertical-align: middle; - color: #7C7BAD; - font-size: 24px; -} - -.o_button_text { - display: inline-block; - vertical-align: middle; - max-width: 70%; - line-height: 1.2; - text-align: left; -} - -.text-hidden-xs { - overflow: hidden; - text-overflow: ellipsis; -} - -/** POPOVER **/ -.popover-content { - font-family: Garuda, sans-serif; - font-size: 12px; - padding: 0px; -} -.popover .h3, .popover h3 { - margin-top: 2px; - margin-bottom: 2px; -} -.popover { - max-width: 400px; - border-radius: 0px; - padding: 0px; -} -.popover .container { - max-width: 100%; -} -.popover .container p { - margin-top: 2px; - margin-bottom: 0px; -} -.popover .container p.email { - word-wrap: break-word; -} -.popover .container p.board { - margin-top: 0px; -} -.popover header { - font-size: 1.2em; -} - -.fa-1_5x { - font-size: 1.5em; -} -.fa-2_5x { - font-size: 2.5em; -} -.fa-text-inside { - font-family: Garuda, sans-serif; - font-size: 12px; -} -.popover .col-sm-2, .popover .col-sm-4, .popover .col-sm-6, .popover .col-sm-12 { - padding-top: 3px; - padding-bottom: 3px; -} -/* custom styles for popover info */ -.popover .circle { - height:35px; - min-width:35px; - line-height:35px; - border-radius:50px; - text-align:center; - color:#fff; - background:#777; - margin-right: .65em; - padding: 0 5px; -} - -.popover .bg-gray-lighter { - background-color: #ddd; - color: #777; -} -.popover .text-gray-dark { - color: #777; -} - - -/* Spacing in Bootstrap v4.0 */ -.mt-3 { - margin-top: 3px; -} -.mt-5 { - margin-top: 5px; -} -.mt-10 { - margin-top: 10px !important; -} -.my-10 { - margin-top: 10px !important; - margin-bottom: 10px !important; -} -.mt-25 { - margin-top: 25px; -} -.mr-5 { - margin-right: 5px; -} -.mx-15 { - margin-left: 15px; - margin-right: 15px; -} -.mx-25 { - margin-left: 25px; - margin-right: 25px; -} -.px-0 { - padding-left: 0px; - padding-right: 0px; -} -.py-5 { - padding-top: 5px; - padding-bottom: 5px; -} -.pt-9 { - padding-top: 9px; -} -.pb-3 { - padding-bottom: 3px; -} -.pb-10 { - padding-bottom: 10px; -} -.pl-5 { - padding-left: 5px; -} -.pr-0 { - padding-right: 0px; -} - -/* WARNING: The .row-eq-height class uses CSS3's flexbox layout mode, - which is not supported in Internet Explorer 9 and below. */ -.row-eq-height { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; -} - -/* TODO: Use Odoo Colours based on http://www.odoo.com/openerp_website/static/src/less/variables.less */ - -div.diagonal { - overflow: hidden; - background-color: #777; -} -.diagonal:before { - content: ""; - border-top: 700px solid #777; - border-right: 500px solid #ddd; - position: absolute; - left: 40%; - bottom: 0; -} -div.diagonal_pending_amount { - background-color: #A24689; -} -.diagonal_pending_amount::before { - border-top-color: #A24689; -} - -div.triangle-right { - overflow: hidden; - color: white; - background-color: #7c7bad; -} -.triangle-right:before { - content: ""; - position: absolute; - border: 26px solid #ddd; - height: 0; - width: 100%; - left: 47%; - top: 0; - bottom: 0; - margin: auto; - border-left-color: transparent; -} - -div.on-top { - position: inherit; -} -div.pull-right-custom { - float: right !important; - margin-right: 15px; - color: #777; - text-align: right; -} - -@keyframes blinker { - 50% { opacity: 0; } -} \ No newline at end of file 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 deleted file mode 100644 index db93063ec..000000000 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_controller.js +++ /dev/null @@ -1,1113 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.PMSCalendarController', function (require) { -"use strict"; - -var AbstractController = require('web.AbstractController'), - ViewDialogs = require('web.view_dialogs'), - Dialog = require('web.Dialog'), - Core = require('web.core'), - Bus = require('bus.bus').bus, - HotelConstants = require('hotel_calendar.Constants'), - MultiCalendar = require('hotel_calendar.MultiCalendar'), - - _t = Core._t, - QWeb = Core.qweb; - -var PMSCalendarController = AbstractController.extend({ - custom_events: _.extend({}, AbstractController.prototype.custom_events, { - onLoadViewFilters: '_onLoadViewFilters', - onViewAttached: '_onViewAttached', - onApplyFilters: '_onApplyFilters', - }), - - _last_dates: [], - - init: function (parent, model, renderer, params) { - this._super.apply(this, arguments); - this.displayName = params.displayName; - this.formViewId = params.formViewId; - this.context = params.context; - - this._multi_calendar = new MultiCalendar(this); - - Bus.on("notification", this, this._onBusNotification); - }, - - start: function() { - this._super.apply(this, arguments); - var self = this; - - this._multi_calendar.setElement(this.renderer.$el.find('#hcal_widget')); - this._multi_calendar.reset(); - this._multi_calendar.start(); - - this._assign_multi_calendar_events(); - this._load_calendar_settings(); - }, - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - savePricelist: function (calendar, pricelist_id, pricelist) { - var self = this; - var oparams = [pricelist_id, false, pricelist, {}, {}]; - this.model.save_changes(oparams).then(function(results){ - $(calendar.btnSaveChanges).removeClass('need-save'); - $(calendar.edtable).find('.hcal-input-changed').removeClass('hcal-input-changed'); - }); - }, - - updateReservations: function (calendar, ids, values, oldReserv, newReserv) { - var self = this; - return this.model.update_records(ids, values).then(function(result){ - // Remove OB Room Row? - if ((oldReserv.room.overbooking && !newReserv.room.overbooking) || (oldReserv.room.cancelled && !newReserv.room.cancelled)) { - self._multi_calendar.remove_extra_room_row(oldReserv, true); - } - }).fail(function(err, errev){ - calendar.replaceReservation(newReserv, oldReserv); - }); - }, - - swapReservations: function (fromIds, toIds, detail, refFromReservDiv, refToReservDiv) { - var self = this; - return this.model.swap_reservations(fromIds, toIds).then(function(results){ - var allReservs = detail.inReservs.concat(detail.outReservs); - for (var nreserv of allReservs) { - self.renderer.$el.find(nreserv._html).stop(true); - } - }).fail(function(err, errev){ - for (var nreserv of detail.inReservs) { - self.renderer.$el.find(nreserv._html).animate({'top': refFromReservDiv.style.top}, 'fast'); - } - for (var nreserv of detail.outReservs) { - self.renderer.$el.find(nreserv._html).animate({'top': refToReservDiv.style.top}, 'fast'); - } - - self._multi_calendar.swap_reservations(detail.outReservs, detail.inReservs); - }); - }, - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - _updateRecord: function (record) { - return this.model.updateRecord(record).then(this.reload.bind(this)); - }, - - _load_calendars: function (ev) { - var self = this; - - /** DO MAGIC **/ - var hcal_dates = this.renderer.get_view_filter_dates(); - var oparams = [ - hcal_dates[0].subtract(1, 'd').format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - hcal_dates[1].format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT) - ]; - - this.model.get_calendar_data(oparams).then(function(results){ - self._multi_calendar._days_tooltips = results['events']; - self._multi_calendar._reserv_tooltips = results['tooltips']; - var rooms = []; - for (var r of results['rooms']) { - var nroom = new HRoom( - r['id'], - r['name'], - r['capacity'], - r['class_name'], - r['shared'], - r['price'] - ); - nroom.addUserData({ - 'room_type_name': r['room_type_name'], - 'room_type_id': r['room_type_id'], - 'floor_id': r['floor_id'], - 'amenities': r['amenity_ids'], - 'class_id': r['class_id'], - }); - rooms.push(nroom); - } - - var reservs = []; - for (var r of results['reservations']) { - var nreserv = self._create_reservation_obj(r); - reservs.push(nreserv); - } - - var options = { - startDate: HotelCalendar.toMomentUTC(self._last_dates[0], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - days: self._view_options['days'], - rooms: rooms, - endOfWeek: parseInt(self._view_options['eday_week']) || 6, - divideRoomsByCapacity: self._view_options['divide_rooms_by_capacity'] || false, - allowInvalidActions: self._view_options['allow_invalid_actions'] || false, - assistedMovement: self._view_options['assisted_movement'] || false, - showPricelist: self._view_options['show_pricelist'] || false, - showAvailability: self._view_options['show_availability'] || false, - showNumRooms: self._view_options['show_num_rooms'] || 0, - endOfWeekOffset: self._view_options['eday_week_offset'] || 0 - }; - - self._multi_calendar.set_options(options); - self._multi_calendar.set_datasets(results['pricelist'], results['restrictions'], reservs); - self._multi_calendar.set_base_element(self.renderer.$el[0]); - - for (var calendar_record of results['calendars']) { - var calendar_index = self._multi_calendar.create_calendar(calendar_record); - var domain = self._generate_calendar_filters_domain(calendar_record); - var calendar = self._multi_calendar.get_calendar(calendar_index+1); - calendar.setDomain(HotelCalendar.DOMAIN.ROOMS, domain); - } - - self._multi_calendar.set_active_calendar(self._multi_calendar._calendars.length-1); - self._update_buttons_counter(); - }); - }, - - _generate_calendar_filters_domain: function(calendar) { - var domain = []; - if (calendar['segmentation_ids'] && calendar['segmentation_ids'].length > 0) { - domain.push(['class_id', 'in', calendar['segmentation_ids']]); - } - if (calendar['location_ids'] && calendar['location_ids'].length > 0) { - domain.push(['floor_id', 'in', calendar['location_ids']]); - } - if (calendar['amenity_ids'] && calendar['amenity_ids'].length > 0) { - domain.push(['amenities', 'in', calendar['amenity_ids']]); - } - if (calendar['room_type_ids'] && calendar['room_type_ids'].length > 0) { - domain.push(['room_type_id', 'some', calendar['room_type_ids']]); - } - return domain; - }, - - _load_calendar_settings: function (ev) { - var self = this; - return this.model.get_hcalendar_settings().then(function(options){ - self._view_options = options; - - if (['xs', 'md'].indexOf(self._find_bootstrap_environment()) >= 0) { - self._view_options['days'] = 7; - } - - var date_begin = moment().local().startOf('day'); - var days = self._view_options['days']; - if (self._view_options['days'] === 'month') { - days = date_begin.daysInMonth(); - } - self._last_dates[0] = date_begin.clone(); - self._last_dates[1] = date_begin.clone().add(days, 'd'); - - var $dateTimePickerBegin = self.renderer.$el.find('#pms-menu #date_begin'); - var $dateEndDays = self.renderer.$el.find('#pms-menu #date_end_days'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - $dateEndDays.val(self._view_options['days']); - - self._load_calendars(); - self._assign_view_events(); - }); - }, - - _reload_active_calendar: function() { - var self = this; - var active_calendar = this._multi_calendar.get_active_calendar(); - var filterDates = active_calendar.getDates(); - // Clip dates - var dfrom = filterDates[0].clone(), - dto = filterDates[1].clone(); - - if (filterDates[0].isBetween(this._last_dates[0], this._last_dates[1], 'days') && filterDates[1].isAfter(this._last_dates[1], 'day')) { - dfrom = this._last_dates[1].clone(); - } else if (this._last_dates[0].isBetween(filterDates[0], filterDates[1], 'days') && this._last_dates[1].isAfter(filterDates[0], 'day')) { - dto = this._last_dates[0].clone(); - } - - var oparams = [ - dfrom.subtract(1, 'd').format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - dto.format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - false - ]; - - this.model.get_calendar_data(oparams).then(function(results){ - var reservs = []; - for (var r of results['reservations']) { - var nreserv = self._create_reservation_obj(r); - reservs.push(nreserv); - } - - self._multi_calendar._reserv_tooltips = _.extend(this._multi_calendar._reserv_tooltips, results['tooltips']); - _.defer(function(){ - self._multi_calendar.merge_days_tooltips(results['events']); - self._multi_calendar.merge_pricelist(results['pricelist'], active_calendar); - self._multi_calendar.merge_restrictions(results['restrictions'], active_calendar); - self._multi_calendar.merge_reservations(reservs, active_calendar); - - self._multi_calendar._assign_extra_info(active_calendar); - self._update_buttons_counter(); - }); - }.bind(this)).then(function(){ - self._last_dates = filterDates; - }); - }, - - _assign_view_events: function() { - var self = this; - var $dateTimePickerBegin = this.renderer.$el.find('#pms-menu #date_begin'); - var $dateEndDays = this.renderer.$el.find('#pms-menu #date_end_days'); - $dateTimePickerBegin.on("dp.change", function (e) { - $dateTimePickerBegin.data("DateTimePicker").hide(); - self._on_change_filter_date(); - }); - $dateEndDays.on("change", function (e) { - self._on_change_filter_date(); - }); - - this.renderer.$el.find("#btn_swap > button").on('click', function(ev){ - var active_calendar = self._multi_calendar.get_active_calendar(); - var hcalSwapMode = active_calendar.getSwapMode(); - var $btn = $(this); - if (hcalSwapMode === HotelCalendar.MODE.NONE) { - active_calendar.setSwapMode(HotelCalendar.MODE.SWAP_FROM); - $("#btn_swap span.ntext").html(_t("Continue")); - $btn.removeClass('swap-to'); - $btn.addClass('swap-from'); - } else if (active_calendar.getReservationAction().inReservations.length > 0 && hcalSwapMode === HotelCalendar.MODE.SWAP_FROM) { - active_calendar.setSwapMode(HotelCalendar.MODE.SWAP_TO); - $("#btn_swap span.ntext").html(_t("End")); - $btn.removeClass('swap-from'); - $btn.addClass('swap-to'); - } else { - active_calendar.setSwapMode(HotelCalendar.MODE.NONE); - $("#btn_swap span.ntext").html(_t("Start Swap")); - $btn.removeClass('swap-from swap-to'); - } - }); - - this.renderer.$el.find('#pms-menu #btn_action_overbooking > button').on('click', function(ev){ - var active_calendar = self._multi_calendar.get_active_calendar(); - active_calendar.toggleOverbookingsVisibility(); - if (active_calendar.options.showOverbookings) { - $(this).addClass('overbooking-enabled'); - } else { - $(this).removeClass('overbooking-enabled'); - } - active_calendar.addReservations(_.reject(self._multi_calendar._dataset['reservations'], {overbooking:false})); - }); - - this.renderer.$el.find('#pms-menu #btn_action_cancelled > button').on('click', function(ev){ - var active_calendar = self._multi_calendar.get_active_calendar(); - active_calendar.toggleCancelledVisibility(); - if (active_calendar.options.showCancelled) { - $(this).addClass('cancelled-enabled'); - } else { - $(this).removeClass('cancelled-enabled'); - } - active_calendar.addReservations(_.reject(self._multi_calendar._dataset['reservations'], {cancelled:false})); - }); - - this.renderer.$el.find('#pms-menu #btn_action_divide > button').on('click', function(ev){ - var active_calendar = self._multi_calendar.get_active_calendar(); - var cur_mode = active_calendar.getSelectionMode(); - active_calendar.setSelectionMode(cur_mode===HotelCalendar.ACTION.DIVIDE?HotelCalendar.MODE.NONE:HotelCalendar.ACTION.DIVIDE); - }); - - this.renderer.$el.find('#pms-menu #btn_action_unify > button').on('click', function(ev){ - var active_calendar = self._multi_calendar.get_active_calendar(); - var cur_mode = active_calendar.getSelectionMode(); - active_calendar.setSelectionMode(cur_mode===HotelCalendar.ACTION.UNIFY?HotelCalendar.MODE.NONE:HotelCalendar.ACTION.UNIFY); - }); - - this.renderer.$el.find('#pms-menu #btn_save_calendar_record').on('click', function(ev){ - var active_calendar_record = self._multi_calendar.get_calendar_record(self._multi_calendar.get_active_index()); - - var name = self.renderer.$el.find('#pms-menu #calendar_name').val(); - var category = _.map(self.renderer.$el.find('#pms-menu #type_list').val(), function(item){ return +item; }); - var floor = _.map(self.renderer.$el.find('#pms-menu #floor_list').val(), function(item){ return +item; }); - var amenities = _.map(self.renderer.$el.find('#pms-menu #amenities_list').val(), function(item){ return +item; }); - var types = _.map(self.renderer.$el.find('#pms-menu #virtual_list').val(), function(item){ return +item; }); - var oparams = { - 'name': name, - 'segmentation_ids': [[6, false, category]], - 'location_ids': [[6, false, floor]], - 'amenity_ids': [[6, false, amenities]], - 'room_type_ids': [[6, false, types]], - } - - self._multi_calendar.update_active_tab_name(name); - self.model.update_or_create_calendar_record(active_calendar_record['id'], oparams).then(function(){ - active_calendar_record.name = name; - active_calendar_record.segmentation_ids = category; - active_calendar_record.location_ids = floor; - active_calendar_record.amenity_ids = amenities; - active_calendar_record.room_type_ids = types; - }).fail(function(){ - self._multi_calendar.update_active_tab_name(active_calendar_record.name); - }); - }); - - this.renderer.$el.find('#pms-menu #btn_reload_calendar_filters').on('click', function(ev){ - var active_calendar_record = self._multi_calendar.get_calendar_record(self._multi_calendar.get_active_index()); - self._multi_calendar.update_active_tab_name(active_calendar_record.name); - var $calendar_name = this.renderer.$el.find('#pms-menu .menu-filter-box #calendar_name'); - $calendar_name.val(active_calendar_record.name); - self._refresh_filters({ - 'class_id': active_calendar_record['segmentation_ids'], - 'floor_id': active_calendar_record['location_ids'], - 'amenities': active_calendar_record['amenity_ids'], - 'room_type_id': active_calendar_record['room_type_ids'], - }); - }); - - this.renderer.$el.find('#pms-menu .menu-filter-box #filters').on('show.bs.collapse', function(ev){ - self.renderer.$el.find('#pms-menu .menu-filter-box h4 i.fa').css({transform: 'rotate(90deg)'}); - }).on('hide.bs.collapse', function(ev){ - self.renderer.$el.find('#pms-menu .menu-filter-box h4 i.fa').css({transform: 'rotate(0deg)'}); - }); - this._multi_calendar.on('tab_changed', function(ev, active_index){ - if (active_index) { - self._refresh_view_options(active_index); - } - }); - }, - - _assign_multi_calendar_events: function() { - var self = this; - this._multi_calendar.on_calendar('hcalOnSavePricelist', function(ev){ - document.getElementById("btn_save_changes").disabled = true; - self.savePricelist(ev.detail.calendar_obj, ev.detail.pricelist_id, ev.detail.pricelist); - }); - - $('.hcal-reservation noselect').popover(); - var _destroy_and_clear_popover_mark = function(ev){ - $(".marked-as-having-a-popover").popover('destroy'); - $('.hcal-reservation').removeClass("marked-as-having-a-popover"); - }; - - /* destroy popover if mouse click is done out the popover */ - /* except if you click in the payment button */ - /* TODO: Review because this event is trigger anywhere, even if you click in other buttons! */ - $('html').on('click', function(e) { - if (!$(e.target).hasClass("marked-as-having-a-popover") && - !$(e.target).parents().is('.popover.in') && - (e.target.id !== 'payment_folio')) { - _destroy_and_clear_popover_mark(); - } - }); - this._multi_calendar.on_calendar('hcalOnClickReservation', function(ev){ - var active_calendar = self._multi_calendar.get_active_calendar(); - if ( active_calendar.getSelectionMode() !== HotelCalendar.MODE.NONE - || active_calendar.getSwapMode() !== HotelCalendar.MODE.NONE ) - { - return; - } - if (ev.detail.reservationObj) { - var tp = self._multi_calendar._reserv_tooltips[ev.detail.reservationObj.id]; - var qdict = self._generate_reservation_tooltip_dict(tp); - $(".marked-as-having-a-popover").popover('destroy'); - $(ev.detail.reservationDiv).addClass('marked-as-having-a-popover'); - var $reservationPopover = $(ev.detail.reservationDiv).popover({ - trigger: 'manual', - container: 'body', - animation: false, - html: true, - placement: 'auto bottom', - content: QWeb.render('HotelCalendar.TooltipReservation', qdict) - }).popover('show'); - /* add actions */ - $reservationPopover.data('bs.popover').tip().find(".btn_popover_open_folio").on('click', - {folio_id: ev.detail.reservationObj._userData.folio_id}, function(ev){ - _destroy_and_clear_popover_mark(); - self.do_action({ - type: 'ir.actions.act_window', - res_model: 'hotel.folio', - res_id: ev.data.folio_id, - views: [[false, 'form']], - }); - }); - $reservationPopover.data('bs.popover').tip().find(".btn_popover_open_reservation").on('click', - {reservation_id: ev.detail.reservationObj.id}, function(ev){ - _destroy_and_clear_popover_mark(); - self.do_action({ - type: 'ir.actions.act_window', - res_model: 'hotel.reservation', - res_id: ev.data.reservation_id, - views: [[false, 'form']] - }); - }); - $reservationPopover.data('bs.popover').tip().find(".btn_popover_open_payment_folio").on('click', - {reservation: ev.detail.reservationObj}, function(ev){ - if (ev.data.reservation.total_folio <= ev.data.reservation.total_reservation || - $('#payment_reservation').hasClass('in')) { - _destroy_and_clear_popover_mark(); - var x = self._rpc({ - model: 'hotel.reservation', - method: 'action_pay_folio', - args: [ev.data.reservation.id], - }).then(function (result){ - return self.do_action({ - name: result.name, - view_type: result.view_type, - view_mode: result.view_mode, - type: result.type, - res_model: result.res_model, - views: [[result.view_id, 'form']], - context: result.context, - target: result.target, - }); - }); - } else { - $('#payment_folio').css('color', '#A24689'); - $('#folio_pending_amount').css('animation', 'blinker 1s linear'); - $('#price_room').css('animation', 'blinker 1s linear'); - } - }); - $reservationPopover.data('bs.popover').tip().find(".btn_popover_open_payment_reservation").on('click', - {reservation_id: ev.detail.reservationObj.id}, function(ev){ - _destroy_and_clear_popover_mark(); - var x = self._rpc({ - model: 'hotel.reservation', - method: 'action_pay_reservation', - args: [ev.data.reservation_id], - }).then(function (result){ - return self.do_action({ - name: result.name, - view_type: result.view_type, - view_mode: result.view_mode, - type: result.type, - res_model: result.res_model, - views: [[result.view_id, 'form']], - context: result.context, - target: result.target, - }); - }); - }); - $reservationPopover.data('bs.popover').tip().find(".btn_popover_open_checkin").on('click', - {reservation_id: ev.detail.reservationObj.id}, function(ev){ - _destroy_and_clear_popover_mark(); - var x = self._rpc({ - model: 'hotel.reservation', - method: 'action_checks', - args: [ev.data.reservation_id], - }).then(function (result){ - return self.do_action(result); - }); - }); - $reservationPopover.data('bs.popover').tip().find(".btn_popover_open_invoice").on('click', - {reservation_id: ev.detail.reservationObj.id}, function(ev){ - _destroy_and_clear_popover_mark(); - var x = self._rpc({ - model: 'hotel.reservation', - method: 'open_invoices_reservation', - args: [ev.data.reservation_id], - }).then(function (result){ - return self.do_action(result); - }); - }); - $reservationPopover.data('bs.popover').tip().find(".btn_popover_close").on('click', function(ev){ - _destroy_and_clear_popover_mark(); - }); - } - }); - this._multi_calendar.on_calendar('hcalOnSplitReservation', function(ev){ - var qdict = {}; - var dialog = new Dialog(self, { - title: _t("Confirm Split Reservation"), - buttons: [ - { - text: _t("Yes, split it"), - classes: 'btn-primary', - close: true, - click: function () { - self.model.split_reservation(ev.detail.obj_id, ev.detail.nights); - } - }, - { - text: _t("No"), - close: true - } - ], - $content: QWeb.render('HotelCalendar.ConfirmSplitOperation', qdict) - }).open(); - }); - this._multi_calendar.on_calendar('hcalOnDblClickReservation', function(ev){ - //var res_id = ev.detail.reservationObj.getUserData('folio_id'); - $(ev.detail.reservationDiv).popover('destroy'); - self.do_action({ - type: 'ir.actions.act_window', - res_model: 'hotel.reservation', - res_id: ev.detail.reservationObj.id, - views: [[false, 'form']] - }); - }); - this._multi_calendar.on_calendar('hcalOnUnifyReservations', function(ev){ - var qdict = {}; - var dialog = new Dialog(self, { - title: _t("Confirm Unify Reservations"), - buttons: [ - { - text: _t("Yes, unify it"), - classes: 'btn-primary', - close: true, - click: function () { - self.model.unify_reservations(_.map(ev.detail.toUnify, 'id')); - } - }, - { - text: _t("No"), - close: true - } - ], - $content: QWeb.render('HotelCalendar.ConfirmUnifyOperation', qdict) - }).open(); - }); - this._multi_calendar.on_calendar('hcalOnSwapReservations', function(ev){ - var qdict = {}; - var dialog = new Dialog(self, { - title: _t("Confirm Reservation Swap"), - buttons: [ - { - text: _t("Yes, swap it"), - classes: 'btn-primary', - close: true, - click: function () { - if (ev.detail.calendar_obj.swapReservations(ev.detail.inReservs, ev.detail.outReservs)) { - var fromIds = _.pluck(ev.detail.inReservs, 'id'); - var toIds = _.pluck(ev.detail.outReservs, 'id'); - var refFromReservDiv = ev.detail.inReservs[0]._html; - var refToReservDiv = ev.detail.outReservs[0]._html; - - // Animate Movement - for (var nreserv of ev.detail.inReservs) { - $(nreserv._html).animate({'top': refToReservDiv.style.top}); - } - for (var nreserv of ev.detail.outReservs) { - $(nreserv._html).animate({'top': refFromReservDiv.style.top}); - } - self.swapReservations(fromIds, toIds, ev.detail, refFromReservDiv, refToReservDiv); - } else { - var qdict = {}; - var dialog = new Dialog(self, { - title: _t("Invalid Reservation Swap"), - buttons: [ - { - text: _t("Oops, Ok!"), - classes: 'btn-primary', - close: true - } - ], - $content: QWeb.render('HotelCalendar.InvalidSwapOperation', qdict) - }).open(); - } - } - }, - { - text: _t("No"), - close: true - } - ], - $content: QWeb.render('HotelCalendar.ConfirmSwapOperation', qdict) - }).open(); - }); - this._multi_calendar.on_calendar('hcalOnCancelSwapReservations', function(ev){ - $("#btn_swap span.ntext").html(_t("Start Swap")); - var $btn = $("#btn_swap > button"); - $btn.removeClass('swap-from swap-to'); - }); - this._multi_calendar.on_calendar('hcalOnChangeReservation', function(ev){ - var newReservation = ev.detail.newReserv; - var oldReservation = ev.detail.oldReserv; - var oldPrice = ev.detail.oldPrice; - var newPrice = ev.detail.newPrice; - var folio_id = newReservation.getUserData('folio_id'); - - var qdict = { - ncheckin: newReservation.startDate.clone().local().format(HotelConstants.L10N_DATE_MOMENT_FORMAT), - ncheckout: newReservation.endDate.clone().local().format(HotelConstants.L10N_DATE_MOMENT_FORMAT), - nroom: newReservation.room.number, - nprice: newPrice, - nadults: newReservation.adults, - ocheckin: oldReservation.startDate.clone().local().format(HotelConstants.L10N_DATE_MOMENT_FORMAT), - ocheckout: oldReservation.endDate.clone().local().format(HotelConstants.L10N_DATE_MOMENT_FORMAT), - oroom: oldReservation.room.number, - oprice: oldPrice, - oadults: oldReservation.adults - }; - - if (qdict['ncheckin'] !== qdict['ocheckin'] || qdict['ncheckout'] !== qdict['ocheckout'] - || qdict['nroom'] !== qdict['oroom'] || qdict['nadults'] !== qdict['oadults']) { - var linkedReservs = _.find(ev.detail.calendar_obj._reservations, function(item){ - return item.id !== newReservation.id && !item.unusedZone && item.getUserData('folio_id') === folio_id; - }); - qdict['hasReservsLinked'] = (linkedReservs && linkedReservs.length !== 0)?true:false; - - var hasChanged = false; - - var dialog = new Dialog(self, { - title: _t("Confirm Reservation Changes"), - buttons: [ - { - text: _t("Yes, change it"), - classes: 'btn-primary', - close: true, - disabled: !newReservation.id, - click: function () { - var roomId = newReservation.room.id; - if (newReservation.room.overbooking || newReservation.room.cancelled) { - roomId = +newReservation.room.id.substr(newReservation.room.id.indexOf('@')+1); - } - var write_values = { - 'checkin': newReservation.startDate.format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - 'checkout': newReservation.endDate.format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - 'room_id': roomId, - 'adults': newReservation.adults, - 'overbooking': newReservation.room.overbooking - }; - if (newReservation.room.cancelled) { - write_values['state'] = 'cancelled'; - } else if (!newReservation.room.cancelled && oldReservation.cancelled) { - write_values['state'] = 'draft'; - } - self.updateReservations(ev.detail.calendar_obj, [newReservation.id], - write_values, oldReservation, newReservation); - hasChanged = true; - } - }, - { - text: _t("No"), - close: true, - } - ], - $content: QWeb.render('HotelCalendar.ConfirmReservationChanges', qdict) - }).open(); - dialog.on('closed', this, function(e){ - if (!hasChanged) { - ev.detail.calendar_obj.replaceReservation(newReservation, oldReservation); - } - }); - } - }); - this._multi_calendar.on_calendar('hcalOnUpdateSelection', function(ev){ - for (var td of ev.detail.old_cells) { - $(td).tooltip('destroy'); - } - if (ev.detail.cells.length) { - var last_cell = ev.detail.cells[ev.detail.cells.length-1]; - var date_cell_start = HotelCalendar.toMoment(ev.detail.calendar_obj.etable.querySelector(`#${ev.detail.cells[0].dataset.hcalParentCell}`).dataset.hcalDate); - var date_cell_end = HotelCalendar.toMoment(ev.detail.calendar_obj.etable.querySelector(`#${last_cell.dataset.hcalParentCell}`).dataset.hcalDate).add(1, 'd'); - var parentRow = document.querySelector(`#${ev.detail.cells[0].dataset.hcalParentRow}`); - var room = ev.detail.calendar_obj.getRoom(parentRow.dataset.hcalRoomObjId); - if (room.overbooking || room.cancelled) { - return; - } - var nights = date_cell_end.diff(date_cell_start, 'days'); - var qdict = { - 'total_price': Number(ev.detail.totalPrice).toLocaleString(), - 'nights': nights - }; - $(last_cell).tooltip({ - animation: false, - html: true, - placement: 'top', - title: QWeb.render('HotelCalendar.TooltipSelection', qdict) - }).tooltip('show'); - } - }); - this._multi_calendar.on_calendar('hcalOnChangeSelectionMode', function(ev){ - var $btnDivide = this.renderer.$el.find('#pms-menu #btn_action_divide > button'); - var $btnUnify = this.renderer.$el.find('#pms-menu #btn_action_unify > button'); - if (ev.detail.newMode === HotelCalendar.ACTION.DIVIDE) { - $btnDivide.addClass('divide-enabled'); - } else { - $btnDivide.removeClass('divide-enabled'); - } - if (ev.detail.newMode === HotelCalendar.ACTION.UNIFY) { - $btnUnify.addClass('unify-enabled'); - } else { - $btnUnify.removeClass('unify-enabled'); - } - }.bind(this)); - this._multi_calendar.on_calendar('hcalOnChangeSelection', function(ev){ - var parentRow = document.querySelector(`#${ev.detail.cellStart.dataset.hcalParentRow}`); - var parentCellStart = document.querySelector(`#${ev.detail.cellStart.dataset.hcalParentCell}`); - var parentCellEnd = document.querySelector(`#${ev.detail.cellEnd.dataset.hcalParentCell}`); - var startDate = HotelCalendar.toMoment(parentCellStart.dataset.hcalDate); - var endDate = HotelCalendar.toMoment(parentCellEnd.dataset.hcalDate).add(1, 'd'); - var room = ev.detail.calendar_obj.getRoom(parentRow.dataset.hcalRoomObjId); - if (room.overbooking || room.cancelled) { - return; - } - var numBeds = (room.shared || ev.detail.calendar_obj.getOptions('divideRoomsByCapacity'))?(ev.detail.cellEnd.dataset.hcalBedNum - ev.detail.cellStart.dataset.hcalBedNum)+1:room.capacity; - if (numBeds <= 0) { - return; - } - - // Normalize Dates - if (startDate.isAfter(endDate)) { - var tt = endDate; - endDate = startDate; - startDate = tt; - } - - var def_arrival_hour = self._view_options['default_arrival_hour'].split(':'); - var def_departure_hour = self._view_options['default_departure_hour'].split(':'); - startDate.set({'hour': def_arrival_hour[0], 'minute': def_arrival_hour[1], 'second': 0}); - endDate.set({'hour': def_departure_hour[0], 'minute': def_departure_hour[1], 'second': 0}); - - var popCreate = new ViewDialogs.FormViewDialog(self, { - res_model: 'hotel.reservation', - context: { - 'default_checkin': startDate.utc().format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - 'default_checkout': endDate.utc().format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - 'default_adults': numBeds, - 'default_children': 0, - 'default_room_id': room.id, - 'default_room_type_id': room.getUserData('room_type_id'), - }, - title: _t("Create: ") + _t("Reservation"), - initial_view: "form", - disable_multiple_selection: true, - }).open(); - }); - - this._multi_calendar.on_calendar('hcalOnKeyPressed', function(ev){ - /* add actions */ - }); - - this._multi_calendar.on_calendar('hcalOnDateChanged', function(ev){ - var $dateTimePickerBegin = this.renderer.$el.find('#pms-menu #date_begin'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(ev.detail.date_begin.local()); - this._reload_active_calendar(); - }.bind(this)); - }, - - _create_reservation_obj: function(json_reserv) { - var nreserv = new HReservation({ - 'id': json_reserv['id'], - 'room_id': json_reserv['room_id'], - 'title': json_reserv['name'], - 'adults': json_reserv['adults'], - 'childrens': json_reserv['childrens'], - 'startDate': HotelCalendar.toMoment(json_reserv['checkin'], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - 'endDate': HotelCalendar.toMoment(json_reserv['checkout'], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - 'color': json_reserv['bgcolor'], - 'colorText': json_reserv['color'], - 'splitted': json_reserv['splitted'] || false, - 'readOnly': json_reserv['read_only'] || false, - 'fixDays': json_reserv['fix_days'] || false, - 'fixRooms': json_reserv['fix_room'], - 'unusedZone': false, - 'linkedId': false, - 'overbooking': json_reserv['overbooking'], - 'cancelled': json_reserv['state'] === 'cancelled', - 'total_reservation': json_reserv['price_room_services_set'], - 'total_folio': json_reserv['amount_total'], - }); - nreserv.addUserData({ - 'folio_id': json_reserv['folio_id'], - 'parent_reservation': json_reserv['parent_reservation'], - 'realDates': [ - HotelCalendar.toMoment(json_reserv['real_dates'][0], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT), - HotelCalendar.toMoment(json_reserv['real_dates'][1], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT) - ] - }); - - return nreserv; - }, - - _generate_reservation_tooltip_dict: function(tp) { - return { - 'folio_name': tp['folio_name'], - 'name': tp['name'], - 'phone': tp['phone'], - 'email': tp['email'], - 'room_type_name': tp['room_type_name'], - 'adults': tp['adults'], - 'children': tp['children'], - 'checkin': HotelCalendar.toMomentUTC(tp['real_dates'][0], '').format("DD MMMM"), - 'checkin_day_of_week': HotelCalendar.toMomentUTC(tp['real_dates'][0], '').format("dddd"), - 'checkout': HotelCalendar.toMomentUTC(tp['real_dates'][1], '').format("DD MMMM"), - 'checkout_day_of_week': HotelCalendar.toMomentUTC(tp['real_dates'][1], '').format("dddd"), - 'arrival_hour': tp['arrival_hour'], - 'departure_hour': tp['departure_hour'], - 'price_room_services_set': Number(tp['price_room_services_set']).toLocaleString(), - 'invoices_paid': Number(tp['invoices_paid']).toLocaleString(), - 'pending_amount': Number(tp['pending_amount']).toLocaleString(), - 'reservation_type': tp['type'], - 'closure_reason': tp['closure_reason'], - 'out_service_description': tp['out_service_description'], - 'splitted': tp['splitted'], - 'channel_type': tp['channel_type'], - 'board_service_name': tp['board_service_name'], - 'services': tp['services'], - }; - }, - - _update_buttons_counter: function (ev) { - var self = this; - var active_calendar = this._multi_calendar.get_active_calendar(); - - var filterDates = active_calendar.getDates(); - var dfrom_fmt = filterDates[0].format(HotelConstants.ODOO_DATE_MOMENT_FORMAT), - dto_fmt = filterDates[1].format(HotelConstants.ODOO_DATE_MOMENT_FORMAT), - now_fmt = moment().format(HotelConstants.ODOO_DATE_MOMENT_FORMAT); - - var domain_checkouts = [ - ['real_checkout', '=', now_fmt], - ['state', 'in', ['booking']], - ['reservation_type', 'not in', ['out']] - ]; - var domain_checkins = [ - ['real_checkin', '=', now_fmt], - ['state', 'in', ['confirm']], - ['reservation_type', 'not in', ['out']] - ]; - var domain_overbookings = [ - ['real_checkin', '>=', dfrom_fmt], - ['overbooking', '=', true], ['state', 'not in', ['cancelled']] - ]; - var domain_cancelled = [ - '|', '&', - ['real_checkout', '>', dfrom_fmt], - ['real_checkout', '<', dto_fmt], - ['real_checkin', '>=', dfrom_fmt], - ['real_checkin', '<=', dto_fmt], - ['state', '=', 'cancelled'] - ]; - - $.when( - this.model.search_count(domain_checkouts), - this.model.search_count(domain_checkins), - this.model.search_count(domain_overbookings), - this.model.search_count(domain_cancelled), - ).then(function(a1, a2, a3, a4){ - self.renderer.update_buttons_counter(a1, a2, a3, a4); - }); - }, - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - _onViewAttached: function (ev) { - this._multi_calendar.recalculate_reservation_positions(); - }, - - _onLoadViewFilters: function (ev) { - var self = this; - $.when( - this.model.get_room_type_class(), - this.model.get_floors(), - this.model.get_amenities(), - this.model.get_room_types() - ).then(function(a1, a2, a3, a4){ - self.renderer.loadViewFilters(a1, a2, a3, a4); - }); - }, - - _onBusNotification: function(notifications) { - var need_reload_pricelists = false; - var need_update_counters = false; - var nreservs = [] - for (var notif of notifications) { - if (notif[0][1] === 'hotel.reservation') { - switch (notif[1]['type']) { - case 'reservation': - var reserv = notif[1]['reservation']; - // Only show notifications of other users - // if (notif[1]['subtype'] !== 'noshow' && this._view_options['show_notifications'] && notif[1]['userid'] != this.dataset.context.uid) { - // var qdict = _.clone(reserv); - // qdict = _.extend(qdict, { - // 'checkin': HotelCalendar.toMomentUTC(qdict['checkin'], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT).clone().local().format(HotelConstants.L10N_DATETIME_MOMENT_FORMAT), // UTC -> Local - // 'checkout': HotelCalendar.toMomentUTC(qdict['checkout'], HotelConstants.ODOO_DATETIME_MOMENT_FORMAT).clone().local().format(HotelConstants.L10N_DATETIME_MOMENT_FORMAT), // UTC -> Local - // 'username': notif[1]['username'], - // 'userid': notif[1]['userid'] - // }); - // var msg = QWeb.render('HotelCalendar.Notification', qdict); - // if (notif[1]['subtype'] === "notify") { - // this.do_notify(notif[1]['title'], msg, true); - // } else if (notif[1]['subtype'] === "warn") { - // this.do_warn(notif[1]['title'], msg, true); - // } - // } - - // Create/Update/Delete reservation - if (notif[1]['action'] === 'unlink') { - this._multi_calendar.remove_reservation(reserv['id']); - this._multi_calendar._reserv_tooltips = _.pick(this._multi_calendar._reserv_tooltips, function(value, key, obj){ return key != reserv['id']; }); - nreservs = _.reject(nreservs, function(item){ return item.id == reserv['id']; }); - } else { - nreservs = _.reject(nreservs, {'id': reserv['id']}); // Only like last changes - var nreserv = this._create_reservation_obj(reserv); - this._multi_calendar._reserv_tooltips[reserv['id']] = notif[1]['tooltip']; - nreservs.push(nreserv); - } - need_update_counters = true; - break; - case 'pricelist': - this._multi_calendar.merge_pricelist(notif[1]['price']); - break; - case 'restriction': - this._multi_calendar.merge_restrictions(notif[1]['restriction']); - break; - default: - // Do Nothing - } - } - } - if (nreservs.length > 0) { - this._multi_calendar.merge_reservations(nreservs); - } - if (need_update_counters) { - this._update_buttons_counter(); - } - }, - - _onApplyFilters: function() { - var category = _.map(this.renderer.$el.find('#pms-menu #type_list').val(), function(item){ return +item; }); - var floor = _.map(this.renderer.$el.find('#pms-menu #floor_list').val(), function(item){ return +item; }); - var amenities = _.map(this.renderer.$el.find('#pms-menu #amenities_list').val(), function(item){ return +item; }); - var virtual = _.map(this.renderer.$el.find('#pms-menu #virtual_list').val(), function(item){ return +item; }); - var domain = []; - if (category && category.length > 0) { - domain.push(['class_id', 'in', category]); - } - if (floor && floor.length > 0) { - domain.push(['floor_id', 'in', floor]); - } - if (amenities && amenities.length > 0) { - domain.push(['amenities', 'in', amenities]); - } - if (virtual && virtual.length > 0) { - domain.push(['room_type_id', 'some', virtual]); - } - this._multi_calendar.get_active_calendar().setDomain(HotelCalendar.DOMAIN.ROOMS, domain); - }, - - _on_change_filter_date: function() { - var $dateTimePickerBegin = this.renderer.$el.find('#pms-menu #date_begin'); - var $dateEndDays = this.renderer.$el.find('#pms-menu #date_end_days'); - - // FIXME: Hackish onchange ignore (Used when change dates from code) - if ($dateTimePickerBegin.data("ignore_onchange") || $dateEndDays.data("ignore_onchange")) { - $dateTimePickerBegin.data("ignore_onchange", false); - $dateEndDays.data("ignore_onchange", false); - return true; - } - - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone(); - - var active_calendar = this._multi_calendar.get_active_calendar(); - if (active_calendar && date_begin) { - var days = $dateEndDays.val(); - if (days === 'month') { - days = date_begin.daysInMonth(); - } - var date_end = date_begin.clone().add(days, 'd'); - if (!date_begin.isSame(this._last_dates[0].clone(), 'd') || !date_end.isSame(this._last_dates[1].clone(), 'd')) { - active_calendar.setStartDate(date_begin, $dateEndDays.val(), false, function(){ - this._reload_active_calendar(); - }.bind(this)); - } - } - }, - - _refresh_view_options: function(active_index) { - var active_calendar = this._multi_calendar.get_calendar(active_index); - - /* Dates */ - var $dateTimePickerBegin = this.renderer.$el.find('#pms-menu #date_begin'); - var $dateEndDays = this.renderer.$el.find('#pms-menu #date_end_days'); - - var start_date = active_calendar.getOptions('startDate'); - start_date = start_date.clone().add(1, 'd'); - - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(start_date.local()); - $dateEndDays.data("ignore_onchange", true); - $dateEndDays.val(active_calendar.getOptions('orig_days')); - $dateEndDays.trigger('change'); - - /* Overbooking */ - var $led = this.renderer.$el.find('#pms-menu #btn_action_overbooking > button'); - if (active_calendar.options.showOverbookings) { - $led.addClass('overbooking-enabled'); - } else { - $led.removeClass('overbooking-enabled'); - } - - /* Cancelled */ - $led = this.renderer.$el.find('#pms-menu #btn_action_cancelled > button'); - if (active_calendar.options.showCancelled) { - $led.addClass('cancelled-enabled'); - } else { - $led.removeClass('cancelled-enabled'); - } - - /* Divide */ - $led = this.renderer.$el.find('#pms-menu #btn_action_divide > button'); - if (active_calendar.getSelectionMode() === HotelCalendar.ACTION.DIVIDE) { - $led.addClass('divide-enabled'); - } else { - $led.removeClass('divide-enabled'); - } - - /* Unify Led */ - $led = this.renderer.$el.find('#pms-menu #btn_action_unify > button'); - if (active_calendar.getSelectionMode() === HotelCalendar.ACTION.UNIFY) { - $led.addClass('unify-enabled'); - } else { - $led.removeClass('unify-enabled'); - } - - /* Calendar Record */ - var active_calendar_record = this._multi_calendar.get_calendar_record(active_index); - var $calendar_name = this.renderer.$el.find('#pms-menu .menu-filter-box #calendar_name'); - $calendar_name.val(active_calendar_record['name']); - - /* Calendar Filters */ - this._refresh_filters(this._multi_calendar.get_active_filters()); - this._update_buttons_counter(); - }, - - _refresh_filters: function(calendar_filters) { - var $segmentation = this.renderer.$el.find('#pms-menu #type_list'); - var $location = this.renderer.$el.find('#pms-menu #floor_list'); - var $amenities = this.renderer.$el.find('#pms-menu #amenities_list'); - var $types = this.renderer.$el.find('#pms-menu #virtual_list'); - $segmentation.val(calendar_filters['class_id']); - $segmentation.trigger('change'); - $location.val(calendar_filters['floor_id']); - $location.trigger('change'); - $amenities.val(calendar_filters['amenities']); - $amenities.trigger('change'); - $types.val(calendar_filters['room_type_id']); - $types.trigger('change'); - }, - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - _find_bootstrap_environment: function() { - var envs = ['xs', 'sm', 'md', 'lg']; - - var $el = $('
'); - $el.appendTo($('body')); - - for (var i = envs.length - 1; i >= 0; i--) { - var env = envs[i]; - - $el.addClass('hidden-'+env); - if ($el.is(':hidden')) { - $el.remove(); - return env; - } - } - }, -}); - -return PMSCalendarController; - -}); 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 deleted file mode 100644 index 96eb3b4aa..000000000 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_model.js +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.PMSCalendarModel', function (require) { -"use strict"; - -var AbstractModel = require('web.AbstractModel'), - Context = require('web.Context'), - Core = require('web.core'), - FieldUtils = require('web.field_utils'), - Session = require('web.session'); - - -return AbstractModel.extend({ - init: function () { - this._super.apply(this, arguments); - }, - - load: function (params) { - this.modelName = params.modelName; - this.modelManagementName = 'hotel.calendar.management' - }, - - swap_reservations: function(fromIds, toIds) { - return this._rpc({ - model: this.modelName, - method: 'swap_reservations', - args: [fromIds, toIds], - context: Session.user_context, - }); - }, - - get_calendar_data: function(oparams) { - var dialog = bootbox.dialog({ - message: '
Getting Calendar Data From Server...
', - onEscape: false, - closeButton: false, - size: 'small', - backdrop: false, - }); - return this._rpc({ - model: this.modelName, - method: 'get_hcalendar_all_data', - args: oparams, - context: Session.user_context, - }, { - xhr: function () { - var xhr = new window.XMLHttpRequest(); - //Download progress - xhr.addEventListener("readystatechange", function() { - if (this.readyState == this.DONE) { - console.log(`[HotelCalendar] Downloaded ${(parseInt(xhr.getResponseHeader("Content-Length"), 10)/1024).toFixed(3)}KiB of data`); - } - }, false); - return xhr; - }, - success: function() { - dialog.modal('hide'); - }, - shadow: true, - }); - }, - - get_hcalendar_settings: function() { - return this._rpc({ - model: this.modelName, - method: 'get_hcalendar_settings', - args: [false], - }); - }, - - get_room_types: function() { - var domain = [['hotel_id', '=', Session.hotel_id]]; - return this._rpc({ - model: 'hotel.room.type', - method: 'search_read', - args: [domain, ['id','name']], - context: Session.user_context, - }); - }, - get_floors: function() { - var domain = [('|', - ['hotel_ids', 'in', Session.hotel_id], - ['hotel_ids', '=', false] - )]; - return this._rpc({ - model: 'hotel.floor', - method: 'search_read', - args: [domain, ['id','name']], - context: Session.user_context, - }); - }, - get_amenities: function() { - var domain = [('|', - ['hotel_ids', 'in', Session.hotel_id], - ['hotel_ids', '=', false] - )]; - // TODO: Filter rooms by amenities is not working - return this._rpc({ - model: 'hotel.amenity', - method: 'search_read', - args: [domain, ['id','name']], - context: Session.user_context, - }); - }, - get_room_type_class: function() { - var domain = [('|', - ['hotel_ids', 'in', Session.hotel_id], - ['hotel_ids', '=', false] - )]; - return this._rpc({ - model: 'hotel.room.type.class', - method: 'search_read', - args: [domain, ['id','name']], - context: Session.user_context, - }); - }, - - search_count: function(domain) { - domain.push(['hotel_id', '=', Session.hotel_id]); - return this._rpc({ - model: this.modelName, - method: 'search_count', - args: [domain], - context: Session.user_context, - }); - }, - - update_records: function(ids, vals) { - return this._rpc({ - model: this.modelName, - method: 'write', - args: [ids, vals], - context: Session.user_context, - }); - }, - - update_or_create_calendar_record: function(ids, vals) { - if (!ids) { - return this._rpc({ - model: 'hotel.calendar', - method: 'create', - args: [vals], - context: Session.user_context, - }); - } - return this._rpc({ - model: 'hotel.calendar', - method: 'write', - args: [ids, vals], - context: Session.user_context, - }); - }, - - folio_search_count: function(domain) { - return this._rpc({ - model: 'hotel.folio', - method: 'search_count', - args: [domain], - context: Session.user_context, - }); - }, - - split_reservation: function(id, nights) { - return this._rpc({ - model: this.modelName, - method: 'split', - args: [[id], nights], - context: Session.user_context, - }) - }, - - unify_reservations: function(reserv_ids) { - return this._rpc({ - model: this.modelName, - method: 'unify_ids', - args: [reserv_ids], - context: Session.user_context, - }) - }, - - 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', - args: params, - context: Session.user_context, - }) - } -}); - -}); diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js deleted file mode 100644 index 74f1d7de5..000000000 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_renderer.js +++ /dev/null @@ -1,284 +0,0 @@ -/* global $, odoo, _, HotelCalendar, moment */ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.PMSCalendarRenderer', function (require) { -"use strict"; - -var Core = require('web.core'), - ViewDialogs = require('web.view_dialogs'), - Dialog = require('web.Dialog'), - Session = require('web.session'), - AbstractRenderer = require('web.AbstractRenderer'), - HotelConstants = require('hotel_calendar.Constants'), - //Formats = require('web.formats'), - - _t = Core._t, - _lt = Core._lt, - QWeb = Core.qweb; - -var HotelCalendarView = AbstractRenderer.extend({ - /** VIEW OPTIONS **/ - template: "hotel_calendar.HotelCalendarView", - display_name: _lt('Hotel Calendar'), - icon: 'fa fa-map-marker', - searchable: false, - searchview_hidden: true, - - - /** VIEW METHODS **/ - init: function(parent, state, params) { - this._super.apply(this, arguments); - }, - - start: function () { - this.init_calendar_view(); - return this._super(); - }, - - on_attach_callback: function() { - this._super(); - - if (!this._is_visible) { - // FIXME: Workaround for restore "lost" reservations (Drawn when the view is hidden) - this.trigger_up('onViewAttached'); - } - }, - - /** CUSTOM METHODS **/ - get_view_filter_dates: function () { - var $dateTimePickerBegin = this.$el.find('#pms-menu #date_begin'); - var $dateEndDays = this.$el.find('#pms-menu #date_end_days'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().clone(); - var days = $dateEndDays.val(); - if (days === 'month') { - days = date_begin.daysInMonth(); - } - var date_end = date_begin.clone().add(days, 'd'); - return [date_begin, date_end]; - }, - - update_buttons_counter: function(ncheckouts, ncheckins, noverbookings, ncancelled) { - 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 - $ninfo = self.$el.find('#pms-menu #btn_action_overbooking span.ninfo'); - $ninfo.text(noverbookings); - if (noverbookings) { - $ninfo.parent().parent().addClass('overbooking-highlight'); - } else { - $ninfo.parent().parent().removeClass('overbooking-highlight'); - } - - // Cancelled - $ninfo = self.$el.find('#pms-menu #btn_action_cancelled span.ninfo'); - $ninfo.text(ncancelled); - if (ncancelled) { - $ninfo.parent().parent().addClass('cancelled-highlight'); - } else { - $ninfo.parent().parent().removeClass('cancelled-highlight'); - } - }, - - init_calendar_view: function(){ - var self = this; - - /** VIEW CONTROLS INITIALIZATION **/ - // DATE TIME PICKERS - var DTPickerOptions = { - viewMode: 'months', - icons : { - time: 'fa fa-clock-o', - date: 'fa fa-calendar', - up: 'fa fa-chevron-up', - down: 'fa fa-chevron-down' - }, - //language : moment.locale(), - locale : moment.locale(), - format : HotelConstants.L10N_DATE_MOMENT_FORMAT, - widgetPositioning:{ - horizontal: 'auto', - vertical: 'bottom' - } - }; - var $dateTimePickerBegin = this.$el.find('#pms-menu #date_begin'); - var $dateEndDays = this.$el.find('#pms-menu #date_end_days'); - $dateTimePickerBegin.datetimepicker(DTPickerOptions); - $dateEndDays.select2({ - data: [ - {id:7, text: '1w'}, - {id:12, text: '2w'}, - {id:21, text: '3w'}, - {id:'month', text: '1m'}, - {id:60, text: '2m'}, - {id:90, text: '3m'}, - ], - allowClear: true, - minimumResultsForSearch: -1 - }); - - /* TOUCH EVENTS */ - this.$el.on('touchstart', function(ev){ - var orgEvent = ev.originalEvent; - this._mouseEventStartPos = [orgEvent.touches[0].screenX, orgEvent.touches[0].screenY]; - }); - this.$el.on('touchend', function(ev){ - var orgEvent = ev.originalEvent; - if (orgEvent.changedTouches.length > 2) { - var mousePos = [orgEvent.changedTouches[0].screenX, orgEvent.changedTouches[0].screenY]; - var mouseDiffX = mousePos[0] - this._mouseEventStartPos[0]; - var moveLength = 40; - var date_begin = false; - var days = orgEvent.changedTouches.length == 3 && 7 || 1; - if (mouseDiffX < -moveLength) { - date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone().add(days, 'd'); - } - else if (mouseDiffX > moveLength) { - date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone().subtract(days, 'd'); - } - if (date_begin) { - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - } - } - }); - - /* BUTTONS */ - var $button = this.$el.find('#pms-menu #btn_action_bookings'); - $button.on('click', function(ev){ self._open_search_tree('book'); }); - $button = this.$el.find('#pms-menu #btn_action_checkins'); - $button.on('click', function(ev){ self._open_search_tree('checkin'); }); - $button = this.$el.find('#pms-menu #btn_action_invoices'); - $button.on('click', function(ev){ self._open_search_tree('invoice'); }); - $button = this.$el.find('#pms-menu #btn_action_folios'); - $button.on('click', function(ev){ self._open_search_tree('folio'); }); - // $button = this.$el.find('#pms-menu #bookings_search'); - // $button.on('keypress', function(ev){ - // if (ev.keyCode === 13) { - // self._open_bookings_tree(); - // } - // }); - - this.$el.find("button[data-action]").on('click', function(ev){ - self.do_action(this.dataset.action); - }); - - return $.when( - this.trigger_up('onUpdateButtonsCounter'), - this.trigger_up('onLoadViewFilters'), - ); - }, - - loadViewFilters: function(resultsHotelRoomType, resultsHotelFloor, resultsHotelRoomAmenities, resultsHotelVirtualRooms) { - var $list = this.$el.find('#pms-menu #type_list'); - $list.html(''); - resultsHotelRoomType.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - this.trigger_up('onApplyFilters'); - }.bind(this)); - - // Get Floors - $list = this.$el.find('#pms-menu #floor_list'); - $list.html(''); - resultsHotelFloor.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - this.trigger_up('onApplyFilters'); - }.bind(this)); - - // Get Amenities - $list = this.$el.find('#pms-menu #amenities_list'); - $list.html(''); - resultsHotelRoomAmenities.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - this.trigger_up('onApplyFilters'); - }.bind(this)); - - // Get Virtual Rooms - $list = this.$el.find('#pms-menu #virtual_list'); - $list.html(''); - resultsHotelVirtualRooms.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - this.trigger_up('onApplyFilters'); - }.bind(this)); - }, - - _generate_search_domain: function(tsearch, type) { - var domain = []; - domain.push('|', '|', '|', '|', - ['partner_id.name', 'ilike', tsearch], - ['partner_id.mobile', 'ilike', tsearch], - ['partner_id.vat', 'ilike', tsearch], - ['partner_id.email', 'ilike', tsearch], - ['partner_id.phone', 'ilike', tsearch]); - if (type === 'invoice') { - domain.splice(0, 0, '|'); - domain.push(['number', 'ilike', tsearch]); - } - return domain; - }, - - _generate_search_res_model: function(type) { - var model = ''; - var title = ''; - if (type === 'book') { - model = 'hotel.reservation'; - title = _t('Reservations'); - } else if (type === 'checkin') { - model = 'hotel.checkin.partner'; - title = _t('Checkins'); - } else if (type === 'invoice') { - model = 'account.invoice'; - title = _t('Invoices'); - } else if (type === 'folio') { - model = 'hotel.folio' - title = _t('Folios'); - } - return [model, title]; - }, - - _open_search_tree: function(type) { - var $elm = this.$el.find('#pms-menu #bookings_search'); - var searchQuery = $elm.val(); - var domain = false; - if (searchQuery) { - domain = this._generate_search_domain(searchQuery, type); - } else { - domain = []; - } - - var [model, title] = this._generate_search_res_model(type); - - this.do_action({ - type: 'ir.actions.act_window', - view_mode: 'form', - view_type: 'tree,form', - res_model: model, - views: [[false, 'list'], [false, 'form']], - domain: domain, - name: searchQuery?`${title} for ${searchQuery}`:`All ${title}` - }); - - $elm.val(''); - }, -}); - -return HotelCalendarView; - -}); diff --git a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js b/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js deleted file mode 100644 index 757f38e50..000000000 --- a/hotel_calendar/static/src/js/views/calendar/hotel_calendar_view.js +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.PMSCalendarView', function (require) { -"use strict"; - -var AbstractView = require('web.AbstractView'), - PMSCalendarModel = require('hotel_calendar.PMSCalendarModel'), - PMSCalendarController = require('hotel_calendar.PMSCalendarController'), - PMSCalendarRenderer = require('hotel_calendar.PMSCalendarRenderer'), - ViewRegistry = require('web.view_registry'), - SystrayMenu = require('web.SystrayMenu'), - ControlPanel = require('web.ControlPanel'), - Widget = require('web.Widget'), - Session = require('web.session'), - Core = require('web.core'), - - _lt = Core._lt, - QWeb = Core.qweb; - -/* HIDE CONTROL PANEL */ -/* FIXME: Look's like a hackish solution */ -ControlPanel.include({ - update: function(status, options) { - if (typeof options === 'undefined') { - options = {}; - } - if (typeof options.toHide === 'undefined') - options.toHide = false; - var action_stack = this.getParent().action_stack; - if (action_stack && action_stack.length) { - var active_action = action_stack[action_stack.length-1]; - if (active_action.widget && active_action.widget.active_view && - active_action.widget.active_view.type === 'pms'){ - options.toHide = true; - } - } - this._super(status, options); - this._toggle_visibility(!options.toHide); - } -}); - -/** SYSTRAY **/ -var CalendarMenu = Widget.extend({ - template: 'HotelCalendar.SettingsMenu', - events: { - "click a[data-action]": "perform_callback", - }, - - start: function(){ - this.$dropdown = this.$(".o_calendar_settings_dropdown"); - return $.when( - this._rpc({ - model: 'res.users', - method: 'read', - args: [[Session.uid], ["pms_show_notifications", "pms_show_pricelist", "pms_show_availability"]], - context: Session.user_context, - }) - ).then(function(result) { - this._show_notifications = result[0]['pms_show_notifications']; - this._show_pricelist = result[0]['pms_show_pricelist']; - this._show_availability = result[0]['pms_show_availability']; - return this.update(); - }.bind(this)); - }, - - perform_callback: function (evt) { - evt.preventDefault(); - var params = $(evt.target).data(); - var callback = params.action; - - if (callback && this[callback]) { - this[callback](params, evt); - } else { - console.warn("No handler for ", callback); - } - }, - - update: function() { - // var view_type = this.getParent().getParent()._current_state.view_type; - // if (view_type === 'pms') { - // this.do_show(); - this.$dropdown - .empty() - .append(QWeb.render('HotelCalendar.SettingsMenu.Global', { - manager: this, - })); - // } - // else { - // this.do_hide(); - // } - return $.when(); - }, - - toggle_show_notification: function() { - this._show_notifications = !this._show_notifications; - this._rpc({ - model: 'res.users', - method: 'write', - args: [[Session.uid], {pms_show_notifications: this._show_notifications}], - context: Session.user_context, - }).then(function () { - window.location.reload(); - }); - }, - - toggle_show_pricelist: function() { - this._show_pricelist = !this._show_pricelist; - this._rpc({ - model: 'res.users', - method: 'write', - args: [[Session.uid], {pms_show_pricelist: this._show_pricelist}], - context: Session.user_context, - }).then(function () { - window.location.reload(); - }); - }, - - toggle_show_availability: function() { - this._show_availability = !this._show_availability; - this._rpc({ - model: 'res.users', - method: 'write', - args: [[Session.uid], {pms_show_availability: this._show_availability}], - context: Session.user_context, - }).then(function () { - window.location.reload(); - }); - }, -}); - -var PMSCalendarView = AbstractView.extend({ - display_name: _lt('Calendar PMS'), - icon: 'fa-calendar', - //jsLibs: [], - cssLibs: ['/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css'], - config: { - Model: PMSCalendarModel, - Controller: PMSCalendarController, - Renderer: PMSCalendarRenderer, - }, - - init: function (viewInfo, params) { - this._super.apply(this, arguments); - var arch = viewInfo.arch; - var fields = viewInfo.fields; - var attrs = arch.attrs; - - // If form_view_id is set, then the calendar view will open a form view - // with this id, when it needs to edit or create an event. - this.controllerParams.formViewId = - attrs.form_view_id ? parseInt(attrs.form_view_id, 10) : false; - if (!this.controllerParams.formViewId && params.action) { - var formViewDescr = _.find(params.action.views, function (v) { - return v[1] === 'form'; - }); - if (formViewDescr) { - this.controllerParams.formViewId = formViewDescr[0]; - } - } - - this.controllerParams.readonlyFormViewId = !attrs.readonly_form_view_id || !utils.toBoolElse(attrs.readonly_form_view_id, true) ? false : attrs.readonly_form_view_id; - this.controllerParams.context = params.context || {}; - this.controllerParams.displayName = params.action && params.action.name; - - this.loadParams.fields = fields; - this.loadParams.fieldsInfo = viewInfo.fieldsInfo; - this.loadParams.creatable = false; - - this.loadParams.mode = attrs.mode; - }, -}); - -SystrayMenu.Items.push(CalendarMenu); -ViewRegistry.add('pms', PMSCalendarView); -//Core.view_registry.add('pms', HotelCalendarView); - -return PMSCalendarView; - -}); 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 deleted file mode 100644 index 08bbdb913..000000000 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_controller.js +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.MPMSCalendarController', function (require) { -"use strict"; - -var AbstractController = require('web.AbstractController'), - Core = require('web.core'), - Bus = require('bus.bus').bus, - HotelConstants = require('hotel_calendar.Constants'), - - _t = Core._t, - QWeb = Core.qweb; - -var MPMSCalendarController = AbstractController.extend({ - custom_events: _.extend({}, AbstractController.prototype.custom_events, { - viewUpdated: '_onViewUpdated', - onSaveChanges: '_onSaveChanges', - onLoadCalendar: '_onLoadCalendar', - onLoadCalendarSettings: '_onLoadCalendarSettings', - onLoadNewContentCalendar: '_onLoadNewContentCalendar', - }), - /** - * @override - * @param {Widget} parent - * @param {AbstractModel} model - * @param {AbstractRenderer} renderer - * @param {Object} params - */ - init: function (parent, model, renderer, params) { - this._super.apply(this, arguments); - this.displayName = params.displayName; - this.formViewId = params.formViewId; - this.context = params.context; - - Bus.on("notification", this, this._onBusNotification); - }, - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - - /** - * @param {Object} record - * @param {integer} record.id - * @returns {Deferred} - */ - _updateRecord: function (record) { - return this.model.updateRecord(record).then(this.reload.bind(this)); - }, - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - _onSaveChanges: function (ev) { - var self = this; - this.model.save_changes(_.toArray(ev.data)).then(function(results){ - self.renderer.resetSaveState(); - }); - }, - - _onLoadNewContentCalendar: function (ev) { - var self = this; - var params = this.renderer.generate_params(); - var oparams = [params['dates'][0], params['dates'][1], params['prices'], params['restrictions'], false]; - - this.model.get_hcalendar_data(oparams).then(function(results){ - self.renderer._days_tooltips = results['events']; - self.renderer._hcalendar.setData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']); - self.renderer._assign_extra_info(); - }); - this.renderer._last_dates = params['dates']; - this.renderer.$CalendarHeaderDays = this.renderer.$el.find("div.table-room_type-data-header"); - this.renderer._on_scroll(); // FIXME: Workaround for update sticky header - }, - - _onLoadCalendar: function (ev) { - var self = this; - - /** DO MAGIC **/ - var params = this.renderer.generate_params(); - var oparams = [params['dates'][0], params['dates'][1], false, false, true]; - this.model.get_hcalendar_data(oparams).then(function(results){ - self.renderer._days_tooltips = results['events']; - var rooms = []; - for (var r of results['rooms']) { - var nroom = new HRoomType( - r['id'], - r['name'], - r['capacity'], - r['price'], - ); - rooms.push(nroom); - } - - // Get Pricelists - self.renderer._pricelist_id = results['pricelist_id']; - self.renderer._restriction_id = results['restriction_id']; - $.when( - self.model.get_pricelist_plans(), - self.model.get_restriction_plans(), - ).then(function(a1, a2){ - self.renderer.loadViewFilters(a1, a2); - }) - - self.renderer.create_calendar(rooms); - self.renderer.setCalendarData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']); - }); - }, - - _onLoadCalendarSettings: function (ev) { - var self = this; - this.model.get_hcalendar_settings().then(function(results){ - self.renderer.setHCalendarSettings(results); - }); - }, - - _onBusNotification: function (notifications) { - if (!this.renderer._hcalendar) { - return; - } - for (var notif of notifications) { - if (notif[0][1] === 'hotel.reservation') { - switch (notif[1]['type']) { - case 'pricelist': - var prices = notif[1]['price']; - var pricelist_id = Object.keys(prices)[0]; - var pr = {}; - for (var price of prices[pricelist_id]) { - pr[price['room']] = []; - var days = Object.keys(price['days']); - for (var day of days) { - var dt = HotelCalendarManagement.toMoment(day); - pr[price['room']].push({ - 'date': dt.format(HotelConstants.ODOO_DATE_MOMENT_FORMAT), - 'price': price['days'][day], - 'id': price['id'] - }); - } - } - this.renderer._hcalendar.addPricelist(pr); - break; - case 'restriction': - // FIXME: Expected one day and one room_type - var restriction = notif[1]['restriction']; - var room_type = Object.keys(restriction)[0]; - var day = Object.keys(restriction[room_type])[0]; - var dt = HotelCalendarManagement.toMoment(day); - var rest = {}; - rest[room_type] = [{ - 'date': dt.format(HotelConstants.ODOO_DATE_MOMENT_FORMAT), - 'min_stay': restriction[room_type][day][0], - 'min_stay_arrival': restriction[room_type][day][1], - 'max_stay': restriction[room_type][day][2], - 'max_stay_arrival': restriction[room_type][day][3], - 'closed': restriction[room_type][day][4], - 'closed_arrival': restriction[room_type][day][5], - 'closed_departure': restriction[room_type][day][6], - 'id': restriction[room_type][day][7] - }]; - this.renderer._hcalendar.addRestrictions(rest); - break; - } - } - } - }, - -}); - -return MPMSCalendarController; - -}); 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 deleted file mode 100644 index 7167dbd32..000000000 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_model.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.MPMSCalendarModel', function (require) { -"use strict"; - -var AbstractModel = require('web.AbstractModel'), - Context = require('web.Context'), - Core = require('web.core'), - FieldUtils = require('web.field_utils'), - Session = require('web.session'); - - -return AbstractModel.extend({ - init: function () { - this._super.apply(this, arguments); - this.end_date = null; - }, - - load: function (params) { - this.modelName = params.modelName; - }, - - 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', - args: params, - context: Session.user_context, - }); - }, - - get_hcalendar_data: function (params) { - return this._rpc({ - model: this.modelName, - method: 'get_hcalendar_all_data', - args: params, - context: Session.user_context, - }); - }, - - get_pricelist_plans: function () { - var domain = [['pricelist_type', '=', 'daily']]; - domain.push('|',['hotel_ids', 'in', Session.hotel_id], - ['hotel_ids', '=', false]); - return this._rpc({ - model: 'product.pricelist', - method: 'search_read', - args: [domain, ['id','name']], - context: Session.user_context, - }); - }, - - get_restriction_plans: function () { - var domain = [['hotel_id', '=', Session.hotel_id]]; - return this._rpc({ - model: 'hotel.room.type.restriction', - method: 'search_read', - args: [domain, ['id','name']], - context: Session.user_context, - }); - }, - - get_hcalendar_settings: function () { - return this._rpc({ - model: this.modelName, - method: 'get_hcalendar_settings', - args: [false], - }); - }, -}); -}); 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 deleted file mode 100644 index be035d910..000000000 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_renderer.js +++ /dev/null @@ -1,512 +0,0 @@ -/* global $, odoo, _, HotelCalendar, moment */ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.MPMSCalendarRenderer', function (require) { -"use strict"; - -var Core = require('web.core'), - ViewDialogs = require('web.view_dialogs'), - Dialog = require('web.Dialog'), - Session = require('web.session'), - AbstractRenderer = require('web.AbstractRenderer'), - HotelConstants = require('hotel_calendar.Constants'), - //Formats = require('web.formats'), - - _t = Core._t, - _lt = Core._lt, - QWeb = Core.qweb; - -var HotelCalendarManagementView = AbstractRenderer.extend({ - /** VIEW OPTIONS **/ - template: "hotel_calendar.HotelCalendarManagementView", - display_name: _lt('Hotel Calendar Management'), - icon: 'fa fa-map-marker', - searchable: false, - searchview_hidden: true, - - // Custom Options - _view_options: {}, - _hcalendar: null, - _last_dates: [false, false], - _pricelist_id: null, - _restriction_id: null, - _days_tooltips: [], - - - /** VIEW METHODS **/ - init: function(parent, state, params) { - this._super.apply(this, arguments); - - this.model = params.model; - }, - - start: function () { - var self = this; - return this._super().then(function() { - self.init_calendar_view(); - $(window).trigger('resize'); - }); - }, - - do_show: function() { - if (this.$ehcal) { - this.$ehcal.show(); - $('.o_content').css('overflow', 'hidden'); - } - this.do_push_state({}); - return this._super(); - }, - do_hide: function () { - if (this.$ehcal) { - this.$ehcal.hide(); - $('.o_content').css('overflow', ''); - } - return this._super(); - }, - - destroy: function () { - return this._super.apply(this, arguments); - }, - - /** CUSTOM METHODS **/ - get_values_to_save: function() { - var btn_save = this.$el.find('#btn_save_changes'); - if (!btn_save.hasClass('need-save')) { - return false; - } - - var pricelist = this._hcalendar.getPricelist(true); - var restrictions = this._hcalendar.getRestrictions(true); - - var params = this.generate_params(); - return [params['prices'], params['restrictions'], pricelist, restrictions]; - }, - - save_changes: function() { - var oparams = this.get_values_to_save(); - if (oparams) { - this.trigger_up('onSaveChanges', oparams); - } - }, - - resetSaveState: function() { - this.$el.find('#btn_save_changes').removeClass('need-save'); - $('.hcal-management-record-changed').removeClass('hcal-management-record-changed'); - $('.hcal-management-input-changed').removeClass('hcal-management-input-changed'); - }, - - create_calendar: function(rooms) { - var self = this; - // CALENDAR - if (this._hcalendar) { - delete this._hcalendar; - } - this.$ehcal.empty(); - - var options = { - rooms: rooms, - days: self._view_options['days'], - endOfWeek: parseInt(self._view_options['eday_week']) || 6, - endOfWeekOffset: self._view_options['eday_week_offset'] || 0, - dateFormatLong: HotelConstants.ODOO_DATETIME_MOMENT_FORMAT, - dateFormatShort: HotelConstants.ODOO_DATE_MOMENT_FORMAT, - translations: { - 'Open': _t('Open'), - 'Closed': _t('Closed'), - 'C. Departure': _t('C. Departure'), - 'C. Arrival': _t('C. Arrival'), - 'Price': _t('Price'), - 'Availability': _t('Availability'), - 'Min. Stay': _t('Min. Stay'), - 'Max. Stay': _t('Max. Stay'), - 'Min. Stay Arrival': _t('Min. Stay Arrival'), - 'Max. Stay Arrival': _t('Max. Stay Arrival'), - 'Clousure': _t('Clousure'), - 'Free Rooms': _t('Free Rooms'), - 'No OTA': _t('No OTA'), - 'Options': _t('Options'), - 'Reset': _t('Reset'), - 'Copy': _t('Copy'), - 'Paste': _t('Paste'), - 'Clone': _t('Clone'), - 'Cancel': _t('Cancel') - } - }; - - this._hcalendar = new HotelCalendarManagement('#hcal_management_widget', options, this.$el[0]); - this._assignHCalendarEvents(); - - this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); - - // Sticky Header Days - $('.o_content').scroll(this._on_scroll.bind(this)); - - // Initialize Save Button state to disable - document.getElementById("btn_save_changes").disabled = true; - }, - - setCalendarData: function (prices, restrictions, availability, count_reservations) { - this._hcalendar.setData(prices, restrictions, availability, count_reservations); - this._assign_extra_info(); - }, - - _assignHCalendarEvents: function () { - var self = this; - this._hcalendar.addEventListener('hcOnChangeDate', function(ev){ - var date_begin = moment(ev.detail.newDate); - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - self.reload_hcalendar_management(); - }); - this._hcalendar.addEventListener('hcmOnInputChanged', function(ev){ - var btn_save = self.$el.find('#btn_save_changes'); - if (self._hcalendar.hasChangesToSave()) { - btn_save.addClass('need-save'); - document.getElementById("btn_save_changes").disabled = false; - } else { - btn_save.removeClass('need-save'); - document.getElementById("btn_save_changes").disabled = true; - } - }); - }, - - _on_scroll: function() { - var curScrollPos = $('.o_content').scrollTop(); - if (curScrollPos > 0) { - this.$CalendarHeaderDays.css({ - top: `${curScrollPos-this.$ehcal.position().top}px`, - position: 'sticky' - }); - } else { - this.$CalendarHeaderDays.css({ - top: '0px', - position: 'initial' - }); - } - }, - - loadViewFilters: function (resultsPricelist, resultsRestrictions) { - var self = this; - - var $list = self.$el.find('#mpms-search #price_list'); - $list.html(''); - resultsPricelist.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - self._check_unsaved_changes(function(){ - self.reload_hcalendar_management(); - }); - }); - - $list = self.$el.find('#mpms-search #restriction_list'); - $list.html(''); - resultsRestrictions.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - self._check_unsaved_changes(function(){ - self.reload_hcalendar_management(); - }); - }); - - $list = self.$el.find('#mpms-search #mode_list'); - $list.select2({ - minimumResultsForSearch: -1 - }); - $list.on('change', function(ev){ - var mode = HotelCalendarManagement.MODE.ALL; - if (this.value === 'low') { - mode = HotelCalendarManagement.MODE.LOW; - } else if (this.value === 'medium') { - mode = HotelCalendarManagement.MODE.MEDIUM; - } - self._hcalendar.setMode(mode); - }); - }, - - call_action: function(action) { - this.do_action(action); - }, - - init_calendar_view: function(){ - var self = this; - - this.$ehcal = this.$el.find("div#hcal_management_widget"); - - /** VIEW CONTROLS INITIALIZATION **/ - // DATE TIME PICKERS - var DTPickerOptions = { - viewMode: 'months', - icons : { - time: 'fa fa-clock-o', - date: 'fa fa-calendar', - up: 'fa fa-chevron-up', - down: 'fa fa-chevron-down' - }, - locale : moment.locale(), - format : HotelConstants.L10N_DATE_MOMENT_FORMAT, - //disabledHours: [0, 1, 2, 3, 4, 5, 6, 7, 8, 18, 19, 20, 21, 22, 23] - }; - - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - $dateTimePickerBegin.datetimepicker(DTPickerOptions); - $dateTimePickerBegin.on("dp.change", function (e) { - $dateTimePickerBegin.data("DateTimePicker").hide(); // TODO: Odoo uses old datetimepicker version - self.on_change_filter_date(e, true); - }); - - var $dateEndDays = this.$el.find('#mpms-search #date_end_days'); - $dateEndDays.select2({ - data: [ - {id:7, text: '1w'}, - {id:12, text: '2w'}, - {id:21, text: '3w'}, - {id:'month', text: '1m'}, - {id:60, text: '2m'}, - {id:90, text: '3m'}, - ], - allowClear: true, - minimumResultsForSearch: -1 - }); - - $dateEndDays.on("change", function (e) { - self.on_change_filter_date(); - }); - - // View Events - this.$el.find("#mpms-search #cal-pag-prev-plus").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().subtract(14, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - self.on_change_filter_date(ev, true); - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-prev").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().subtract(7, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - self.on_change_filter_date(ev, true); - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-next-plus").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().add(14, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - self.on_change_filter_date(ev, true); - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-next").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().add(7, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - self.on_change_filter_date(ev, true); - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-selector").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var date_begin = moment().startOf('day'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - self.on_change_filter_date(ev, true); - ev.preventDefault(); - }); - - // Save Button - this.$el.find("#btn_save_changes").on('click', function(ev) { - document.getElementById(this.id).disabled = true; - self.save_changes(); - }); - - // Launch Massive Changes - this.$el.find("#btn_massive_changes").on('click', function(ev){ - self.call_action("hotel.action_hotel_massive_change"); - }); - - /** RENDER CALENDAR **/ - this.trigger_up('onLoadCalendarSettings'); - }, - - setHCalendarSettings: function (results) { - this._view_options = results; - var date_begin = moment().startOf('day'); - if (['xs', 'md'].indexOf(this._findBootstrapEnvironment()) >= 0) { - this._view_options['days'] = 7; - } else { - this._view_options['days'] = (this._view_options['days'] !== 'month')?parseInt(this._view_options['days']):date_begin.daysInMonth(); - } - - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - $dateTimePickerBegin.data("DateTimePicker").date(date_begin); - - var $dateEndDays = this.$el.find('#mpms-search #date_end_days'); - $dateEndDays.val('month'); - $dateEndDays.trigger('change'); - - this._last_dates = this.generate_params()['dates']; - this.trigger_up('onLoadCalendar'); - }, - - on_change_filter_date: function(ev, isStartDate) { - var self = this; - isStartDate = isStartDate || false; - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - var $dateEndDays = this.$el.find('#mpms-search #date_end_days'); - - // FIXME: Hackish onchange ignore (Used when change dates from code) - if ($dateTimePickerBegin.data("ignore_onchange") || $dateEndDays.data("ignore_onchange")) { - $dateTimePickerBegin.data("ignore_onchange", false); - $dateEndDays.data("ignore_onchange", false); - return true; - } - - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone(); - - if (this._hcalendar && date_begin) { - var days = $dateEndDays.val(); - if (days === 'month') { - days = date_begin.daysInMonth(); - } - var date_end = date_begin.set({'hour': 23, 'minute': 59, 'second': 59}).clone().add(days, 'd'); - - this._check_unsaved_changes(function(){ - self._hcalendar.setStartDate(date_begin, self._hcalendar.getDateDiffDays(date_begin, date_end)); - self.reload_hcalendar_management(); - }); - } - }, - - reload_hcalendar_management: function() { - this.trigger_up('onLoadNewContentCalendar'); - }, - - generate_params: function() { - var fullDomain = []; - var prices = this.$el.find('#mpms-search #price_list').val(); - var restrictions = this.$el.find('#mpms-search #restriction_list').val(); - - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - var $dateEndDays = this.$el.find('#mpms-search #date_end_days'); - - var date_begin = $dateTimePickerBegin.data("DateTimePicker").date().set({'hour': 0, 'minute': 0, 'second': 0}).clone(); - - var days = $dateEndDays.val(); - if (days === 'month') { - days = date_begin.daysInMonth(); - } - var date_end = date_begin.set({'hour': 23, 'minute': 59, 'second': 59}).clone().add(days, 'd'); - return { - 'dates': [date_begin, date_end], - 'prices': prices, - 'restrictions': restrictions - }; - }, - - _check_unsaved_changes: function(fnCallback) { - var self = this; - var btn_save = this.$el.find("#btn_save_changes"); - if (!btn_save.hasClass('need-save')) { - btn_save.removeClass('need-save'); - document.getElementById("btn_save_changes").disabled = true; - fnCallback(); - return; - } - - new Dialog(self, { - title: _t("Unsaved Changes!"), - buttons: [ - { - text: _t("Yes, save it"), - classes: 'btn-primary', - close: true, - click: function() { - document.getElementById("btn_save_changes").disabled = true; - self.save_changes(); - fnCallback(); - } - }, - { - text: _t("No"), - close: true, - click: function() { - btn_save.removeClass('need-save'); - document.getElementById("btn_save_changes").disabled = true; - fnCallback(); - } - } - ], - $content: QWeb.render('HotelCalendarManagement.UnsavedChanges', {}) - }).open(); - }, - - _findBootstrapEnvironment: function() { - var envs = ['xs', 'sm', 'md', 'lg']; - - var $el = $('
'); - $el.appendTo($('body')); - - for (var i = envs.length - 1; i >= 0; i--) { - var env = envs[i]; - - $el.addClass('hidden-'+env); - if ($el.is(':hidden')) { - $el.remove(); - return env; - } - } - }, - - _assign_extra_info: function() { - var self = this; - - $(this._hcalendar.etableHeader).find('.hcal-cell-header-day').each(function(index, elm){ - var $elm = $(elm); - var cdate = HotelCalendarManagement.toMoment($elm.data('hcalDate'), HotelConstants.L10N_DATE_MOMENT_FORMAT); - var data = _.filter(self._days_tooltips, function(item) { - var ndate = HotelCalendarManagement.toMoment(item[2], HotelConstants.ODOO_DATE_MOMENT_FORMAT); - return ndate.isSame(cdate, 'd'); - }); - if (data.length > 0) { - $elm.addClass('hcal-event-day'); - $elm.on("mouseenter", function(data){ - var $this = $(this); - if (data.length > 0) { - var qdict = { - 'date': $this.data('hcalDate'), - 'events': _.map(data, function(item){ - return { - 'name': item[1], - 'date': item[2], - 'location': item[3] - }; - }) - }; - $this.attr('title', ''); - $this.tooltip({ - animation: true, - html: true, - placement: 'bottom', - title: QWeb.render('HotelCalendar.TooltipEvent', qdict) - }).tooltip('show'); - } - }.bind(elm, data)); - } - }); - }, -}); - -return HotelCalendarManagementView; - -}); diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v_deprecated.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v_deprecated.js deleted file mode 100644 index 096866cb2..000000000 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_v_deprecated.js +++ /dev/null @@ -1,661 +0,0 @@ -/* global $, odoo, _, HotelCalendarManagement, moment */ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.HotelCalendarManagementView', function (require) { -"use strict"; - -var Core = require('web.core'), - Bus = require('bus.bus').bus, - //Data = require('web.data'), - Time = require('web.time'), - Model = require('web.DataModel'), - View = require('web.View'), - Widgets = require('web_calendar.widgets'), - //Common = require('web.form_common'), - //Pyeval = require('web.pyeval'), - ActionManager = require('web.ActionManager'), - Utils = require('web.utils'), - Dialog = require('web.Dialog'), - //Ajax = require('web.ajax'), - ControlPanel = require('web.ControlPanel'), - //Session = require('web.session'), - formats = require('web.formats'), - - _t = Core._t, - _lt = Core._lt, - QWeb = Core.qweb, - l10n = _t.database.parameters, - - ODOO_DATETIME_MOMENT_FORMAT = "YYYY-MM-DD HH:mm:ss", - ODOO_DATE_MOMENT_FORMAT = "YYYY-MM-DD", - L10N_DATE_MOMENT_FORMAT = "DD/MM/YYYY", //FIXME: Time.strftime_to_moment_format(l10n.date_format); - L10N_DATETIME_MOMENT_FORMAT = L10N_DATE_MOMENT_FORMAT + ' ' + Time.strftime_to_moment_format(l10n.time_format); - - -/* HIDE CONTROL PANEL */ -/* FIXME: Look's like a hackish solution */ -ControlPanel.include({ - update: function(status, options) { - if (typeof options.toHide === 'undefined') - options.toHide = false; - var action_stack = this.getParent().action_stack; - if (action_stack && action_stack.length) { - var active_action = action_stack[action_stack.length-1]; - if (active_action.widget && active_action.widget.active_view && - active_action.widget.active_view.type === 'mpms'){ - options.toHide = true; - } - } - this._super(status, options); - this._toggle_visibility(!options.toHide); - } -}); - -var HotelCalendarManagementView = View.extend({ - /** VIEW OPTIONS **/ - template: "hotel_calendar.HotelCalendarManagementView", - display_name: _lt('Hotel Calendar Management'), - icon: 'fa fa-map-marker', - //view_type: "mpms", - searchable: false, - searchview_hidden: true, - quick_create_instance: Widgets.QuickCreate, - defaults: _.extend({}, View.prototype.defaults, { - confirm_on_delete: true, - }), - - // Custom Options - _model: null, - _hcalendar: null, - _action_manager: null, - _last_dates: [false, false], - _pricelist_id: null, - _restriction_id: null, - _days_tooltips: [], - - /** VIEW METHODS **/ - init: function(parent, dataset, fields_view, options) { - this._super.apply(this, arguments); - this.shown = $.Deferred(); - this.dataset = dataset; - this.model = dataset.model; - this.view_type = 'mpms'; - this.selected_filters = []; - this.mutex = new Utils.Mutex(); - this._model = new Model(this.dataset.model); - this._action_manager = this.findAncestor(function(ancestor){ return ancestor instanceof ActionManager; }); - - Bus.on("notification", this, this._on_bus_signal); - }, - - start: function () { - this.shown.done(this._do_show_init.bind(this)); - return this._super(); - }, - - _do_show_init: function () { - this.init_calendar_view().then(function() { - $(window).trigger('resize'); - }); - }, - - do_show: function() { - if (this.$ehcal) { - this.$ehcal.show(); - $('.o_content').css('overflow', 'hidden'); - } - this.do_push_state({}); - this.shown.resolve(); - return this._super(); - }, - do_hide: function () { - if (this.$ehcal) { - this.$ehcal.hide(); - $('.o_content').css('overflow', ''); - } - return this._super(); - }, - - destroy: function () { - return this._super.apply(this, arguments); - }, - - /** CUSTOM METHODS **/ - save_changes: function() { - var self = this; - var btn_save = this.$el.find('#btn_save_changes'); - if (!btn_save.hasClass('need-save')) { - return; - } - - var pricelist = this._hcalendar.getPricelist(true); - var restrictions = this._hcalendar.getRestrictions(true); - var availability = this._hcalendar.getAvailability(true); - - var params = this.generate_params(); - var oparams = [false, params['prices'], params['restrictions'], pricelist, restrictions, availability]; - this._model.call('save_changes', oparams).then(function(results){ - btn_save.removeClass('need-save'); - $('.hcal-management-record-changed').removeClass('hcal-management-record-changed'); - $('.hcal-management-input-changed').removeClass('hcal-management-input-changed'); - }); - }, - - create_calendar: function(options) { - var self = this; - // CALENDAR - if (this._hcalendar) { - delete this._hcalendar; - } - - this.$ehcal.empty(); - - this._hcalendar = new HotelCalendarManagement('#hcal_management_widget', options, this.$el[0]); - this._hcalendar.addEventListener('hcOnChangeDate', function(ev){ - var date_begin = moment(ev.detail.newDate); - var days = self._hcalendar.getOptions('days')-1; - var date_end = date_begin.clone().add(days, 'd'); - - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - - self.reload_hcalendar_management(); - }); - this._hcalendar.addEventListener('hcmOnInputChanged', function(ev){ - var btn_save = self.$el.find('#btn_save_changes'); - if (self._hcalendar.hasChangesToSave()) { - btn_save.addClass('need-save'); - } else { - btn_save.removeClass('need-save'); - } - }); - - this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); - - // Sticky Header Days - this.$ehcal.scroll(this._on_scroll.bind(this)); - }, - - _on_scroll: function() { - var curScrollPos = this.$ehcal.scrollTop(); - if (curScrollPos > 0) { - this.$CalendarHeaderDays.css({ - top: `${curScrollPos}px`, - position: 'sticky' - }); - } else { - this.$CalendarHeaderDays.css({ - top: '0px', - position: 'initial' - }); - } - }, - - generate_hotel_calendar: function(){ - var self = this; - debugger; - /** DO MAGIC **/ - var params = this.generate_params(); - var oparams = [params['dates'][0], params['dates'][1], false, false, true]; - this._model.call('get_hcalendar_all_data', oparams).then(function(results){ - self._days_tooltips = results['events']; - var rooms = []; - for (var r of results['rooms']) { - var nroom = new HRoomType( - r[0], // Id - r[1], // Name - r[2], // Capacity - r[3], // Price - ); - rooms.push(nroom); - } - - // Get Pricelists - self._pricelist_id = results['pricelist_id']; - new Model('product.pricelist').query(['id','name']).all().then(function(resultsPricelist){ - var $list = self.$el.find('#mpms-search #price_list'); - $list.html(''); - resultsPricelist.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - self._check_unsaved_changes(function(){ - self.reload_hcalendar_management(); - }); - }); - }); - - // Get Restrictions - self._restriction_id = results['restriction_id']; - new Model('hotel.room.type.restriction').query(['id','name']).all().then(function(resultsRestrictions){ - var $list = self.$el.find('#mpms-search #restriction_list'); - $list.html(''); - resultsRestrictions.forEach(function(item, index){ - $list.append(``); - }); - $list.select2(); - $list.on('change', function(ev){ - self._check_unsaved_changes(function(){ - self.reload_hcalendar_management(); - }); - }); - }); - - // Calendar Mode - var $list = self.$el.find('#mpms-search #mode_list'); - $list.select2({ - minimumResultsForSearch: -1 - }); - $list.on('change', function(ev){ - var mode = HotelCalendarManagement.MODE.ALL; - if (this.value === 'low') { - mode = HotelCalendarManagement.MODE.LOW; - } else if (this.value === 'medium') { - mode = HotelCalendarManagement.MODE.MEDIUM; - } - self._hcalendar.setMode(mode); - }); - - self.create_calendar({ - rooms: rooms, - days: self._view_options['days'], - endOfWeek: parseInt(self._view_options['eday_week']) || 6, - endOfWeekOffset: self._view_options['eday_week_offset'] || 0, - dateFormatLong: ODOO_DATETIME_MOMENT_FORMAT, - dateFormatShort: ODOO_DATE_MOMENT_FORMAT, - translations: { - 'Open': _t('Open'), - 'Closed': _t('Closed'), - 'C. Departure': _t('C. Departure'), - 'C. Arrival': _t('C. Arrival'), - 'Price': _t('Price'), - 'Availability': _t('Availability'), - 'Min. Stay': _t('Min. Stay'), - 'Max. Stay': _t('Max. Stay'), - 'Min. Stay Arrival': _t('Min. Stay Arrival'), - 'Max. Stay Arrival': _t('Max. Stay Arrival'), - 'Clousure': _t('Clousure'), - 'Free Rooms': _t('Free Rooms'), - 'No OTA': _t('No OTA'), - 'Options': _t('Options'), - 'Reset': _t('Reset'), - 'Copy': _t('Copy'), - 'Paste': _t('Paste'), - 'Clone': _t('Clone'), - 'Cancel': _t('Cancel') - } - }); - self._hcalendar.setData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']); - self._assign_extra_info(); - }); - }, - - call_action: function(action) { - this._action_manager.do_action(action); - }, - - init_calendar_view: function(){ - var self = this; - - this.$ehcal = this.$el.find("div#hcal_management_widget"); - - /** VIEW CONTROLS INITIALIZATION **/ - // DATE TIME PICKERS - var l10nn = _t.database.parameters - var DTPickerOptions = { - viewMode: 'months', - icons : { - time: 'fa fa-clock-o', - date: 'fa fa-calendar', - up: 'fa fa-chevron-up', - down: 'fa fa-chevron-down' - }, - language : moment.locale(), - format : L10N_DATE_MOMENT_FORMAT, - disabledHours: true // TODO: Odoo uses old datetimepicker version - }; - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = this.$el.find('#mpms-search #date_end'); - $dateTimePickerBegin.datetimepicker(DTPickerOptions); - $dateTimePickerEnd.datetimepicker($.extend({}, DTPickerOptions, { 'useCurrent': false })); - $dateTimePickerBegin.on("dp.change", function (e) { - $dateTimePickerEnd.data("DateTimePicker").setMinDate(e.date.add(3,'d')); - $dateTimePickerEnd.data("DateTimePicker").setMaxDate(e.date.add(2,'M')); - $dateTimePickerBegin.data("DateTimePicker").hide(); // TODO: Odoo uses old datetimepicker version - self.on_change_filter_date(e, true); - }); - $dateTimePickerEnd.on("dp.change", function (e) { - self.on_change_filter_date(e, false); - $dateTimePickerEnd.data("DateTimePicker").hide(); // TODO: Odoo uses old datetimepicker version - }); - - // var date_begin = moment().startOf('day'); - // var date_end = date_begin.clone().add(this._view_options['days'], 'd').endOf('day'); - // $dateTimePickerBegin.data("ignore_onchange", true); - // $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - // $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - // this._last_dates = this.generate_params()['dates']; - - // View Events - this.$el.find("#mpms-search #cal-pag-prev-plus").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - //var days = moment($dateTimePickerBegin.data("DateTimePicker").getDate()).clone().local().daysInMonth(); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().subtract(14, 'd'); - var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().subtract(14, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-prev").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().subtract(7, 'd'); - var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().subtract(7, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-next-plus").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - //var days = moment($dateTimePickerBegin.data("DateTimePicker").getDate()).clone().local().daysInMonth(); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().add(14, 'd'); - var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().add(14, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-next").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().add(7, 'd'); - var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().add(7, 'd'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - - ev.preventDefault(); - }); - this.$el.find("#mpms-search #cal-pag-selector").on('click', function(ev){ - // FIXME: Ugly repeated code. Change place. - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - var date_begin = moment().startOf('day'); - var date_end = date_begin.clone().add(self._view_options['days'], 'd').endOf('day'); - $dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - - ev.preventDefault(); - }); - - // Save Button - this.$el.find("#btn_save_changes").on('click', function(ev){ - self.save_changes(); - }); - - // Launch Massive Changes - this.$el.find("#btn_massive_changes").on('click', function(ev){ - self.call_action("hotel.action_hotel_massive_change"); - }); - - /** RENDER CALENDAR **/ - this._model.call('get_hcalendar_settings', [false]).then(function(results){ - self._view_options = results; - var date_begin = moment().startOf('day'); - if (['xs', 'md'].indexOf(self._findBootstrapEnvironment()) >= 0) { - self._view_options['days'] = 7; - } else { - self._view_options['days'] = (self._view_options['days'] !== 'month')?parseInt(self._view_options['days']):date_begin.daysInMonth(); - } - var date_end = date_begin.clone().add(self._view_options['days'], 'd').endOf('day'); - var $dateTimePickerBegin = self.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = self.$el.find('#mpms-search #date_end'); - //$dateTimePickerBegin.data("ignore_onchange", true); - $dateTimePickerBegin.data("DateTimePicker").setDate(date_begin); - //$dateTimePickerEnd.data("ignore_onchange", true); - $dateTimePickerEnd.data("DateTimePicker").setDate(date_end); - self._last_dates = self.generate_params()['dates']; - - self.generate_hotel_calendar(); - }); - - return $.when(); - }, - - on_change_filter_date: function(ev, isStartDate) { - var self = this; - isStartDate = isStartDate || false; - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = this.$el.find('#mpms-search #date_end'); - - // FIXME: Hackish onchange ignore (Used when change dates from code) - if ($dateTimePickerBegin.data("ignore_onchange") || $dateTimePickerEnd.data("ignore_onchange")) { - $dateTimePickerBegin.data("ignore_onchange", false); - $dateTimePickerEnd.data("ignore_onchange", false) - return true; - } - - var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().set({'hour': 0, 'minute': 0, 'second': 0}).clone(); - - if (this._hcalendar && date_begin) { - if (isStartDate) { - var ndate_end = date_begin.clone().add(this._view_options['days'], 'd'); - $dateTimePickerEnd.data("ignore_onchange", true); - $dateTimePickerEnd.data("DateTimePicker").setDate(ndate_end.local()); - } - - var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().set({'hour': 23, 'minute': 59, 'second': 59}).clone(); - - this._check_unsaved_changes(function(){ - self._hcalendar.setStartDate(date_begin, self._hcalendar.getDateDiffDays(date_begin, date_end)); - self.reload_hcalendar_management(); - }); - } - }, - - _on_bus_signal: function(notifications) { - if (!this._hcalendar) { - return; - } - for (var notif of notifications) { - if (notif[0][1] === 'hotel.reservation') { - switch (notif[1]['type']) { - case 'availability': - var avail = notif[1]['availability']; - var room_type = Object.keys(avail)[0]; - var day = Object.keys(avail[room_type])[0]; - var dt = HotelCalendarManagement.toMoment(day); - var availability = {}; - availability[room_type] = [{ - 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'avail': avail[room_type][day][0], - 'no_ota': avail[room_type][day][1], - 'id': avail[room_type][day][2] - }]; - this._hcalendar.addAvailability(availability); - break; - case 'pricelist': - var prices = notif[1]['price']; - var pricelist_id = Object.keys(prices)[0]; - var pr = {}; - for (var price of prices[pricelist_id]) { - pr[price['room']] = []; - var days = Object.keys(price['days']); - for (var day of days) { - var dt = HotelCalendarManagement.toMoment(day); - pr[price['room']].push({ - 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'price': price['days'][day], - 'id': price['id'] - }); - } - } - this._hcalendar.addPricelist(pr); - break; - case 'restriction': - // FIXME: Expected one day and one room_type - var restriction = notif[1]['restriction']; - var room_type = Object.keys(restriction)[0]; - var day = Object.keys(restriction[room_type])[0]; - var dt = HotelCalendarManagement.toMoment(day); - var rest = {}; - rest[room_type] = [{ - 'date': dt.format(ODOO_DATE_MOMENT_FORMAT), - 'min_stay': restriction[room_type][day][0], - 'min_stay_arrival': restriction[room_type][day][1], - 'max_stay': restriction[room_type][day][2], - 'max_stay_arrival': restriction[room_type][day][3], - 'closed': restriction[room_type][day][4], - 'closed_arrival': restriction[room_type][day][5], - 'closed_departure': restriction[room_type][day][6], - 'id': restriction[room_type][day][7] - }]; - this._hcalendar.addRestrictions(rest); - break; - } - } - } - }, - - reload_hcalendar_management: function() { - var self = this; - var params = this.generate_params(); - var oparams = [params['dates'][0], params['dates'][1], params['prices'], params['restrictions'], false]; - this._model.call('get_hcalendar_all_data', oparams).then(function(results){ - self._days_tooltips = results['events']; - self._hcalendar.setData(results['prices'], results['restrictions'], results['availability'], results['count_reservations']); - self._assign_extra_info(); - }); - this._last_dates = params['dates']; - this.$CalendarHeaderDays = this.$el.find("div.table-room_type-data-header"); - this._on_scroll(); // FIXME: Workaround for update sticky header - }, - - generate_params: function() { - var fullDomain = []; - var prices = this.$el.find('#mpms-search #price_list').val(); - var restrictions = this.$el.find('#mpms-search #restriction_list').val(); - - var $dateTimePickerBegin = this.$el.find('#mpms-search #date_begin'); - var $dateTimePickerEnd = this.$el.find('#mpms-search #date_end'); - - var date_begin = $dateTimePickerBegin.data("DateTimePicker").getDate().set({'hour': 0, 'minute': 0, 'second': 0}).clone().utc().format(ODOO_DATE_MOMENT_FORMAT); - var date_end = $dateTimePickerEnd.data("DateTimePicker").getDate().set({'hour': 23, 'minute': 59, 'second': 59}).clone().utc().format(ODOO_DATE_MOMENT_FORMAT); - - return { - 'dates': [date_begin, date_end], - 'prices': prices, - 'restrictions': restrictions - }; - }, - - _check_unsaved_changes: function(fnCallback) { - var self = this; - var btn_save = this.$el.find("#btn_save_changes"); - if (!btn_save.hasClass('need-save')) { - btn_save.removeClass('need-save'); - fnCallback(); - return; - } - - new Dialog(self, { - title: _t("Unsaved Changes!"), - buttons: [ - { - text: _t("Yes, save it"), - classes: 'btn-primary', - close: true, - click: function() { - self.save_changes(); - fnCallback(); - } - }, - { - text: _t("No"), - close: true, - click: function() { - btn_save.removeClass('need-save'); - fnCallback(); - } - } - ], - $content: QWeb.render('HotelCalendarManagement.UnsavedChanges', {}) - }).open(); - }, - - _findBootstrapEnvironment: function() { - var envs = ['xs', 'sm', 'md', 'lg']; - - var $el = $('
'); - $el.appendTo($('body')); - - for (var i = envs.length - 1; i >= 0; i--) { - var env = envs[i]; - - $el.addClass('hidden-'+env); - if ($el.is(':hidden')) { - $el.remove(); - return env; - } - } - }, - - _assign_extra_info: function() { - var self = this; - - $(this._hcalendar.etableHeader).find('.hcal-cell-header-day').each(function(index, elm){ - var $elm = $(elm); - var cdate = HotelCalendar.toMoment($elm.data('hcalDate'), L10N_DATE_MOMENT_FORMAT); - var data = _.filter(self._days_tooltips, function(item) { - var ndate = HotelCalendar.toMoment(item[2], ODOO_DATE_MOMENT_FORMAT); - return ndate.isSame(cdate, 'd'); - }); - if (data.length > 0) { - $elm.addClass('hcal-event-day'); - $elm.on("mouseenter", function(data){ - var $this = $(this); - if (data.length > 0) { - var qdict = { - 'date': $this.data('hcalDate'), - 'events': _.map(data, function(item){ - return { - 'name': item[1], - 'date': item[2], - 'location': item[3] - }; - }) - }; - $this.attr('title', ''); - $this.tooltip({ - animation: true, - html: true, - placement: 'bottom', - title: QWeb.render('HotelCalendar.TooltipEvent', qdict) - }).tooltip('show'); - } - }.bind(elm, data)); - } - }); - }, -}); - -Core.view_registry.add('mpms', HotelCalendarManagementView); -return HotelCalendarManagementView; - -}); diff --git a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_view.js b/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_view.js deleted file mode 100644 index 9e3af7d12..000000000 --- a/hotel_calendar/static/src/js/views/calendar_management/hotel_calendar_management_view.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.MPMSCalendarView', function (require) { -"use strict"; - -var AbstractView = require('web.AbstractView'), - MPMSCalendarModel = require('hotel_calendar.MPMSCalendarModel'), - MPMSCalendarController = require('hotel_calendar.MPMSCalendarController'), - MPMSCalendarRenderer = require('hotel_calendar.MPMSCalendarRenderer'), - ViewRegistry = require('web.view_registry'), - SystrayMenu = require('web.SystrayMenu'), - ControlPanel = require('web.ControlPanel'), - Widget = require('web.Widget'), - Session = require('web.session'), - Core = require('web.core'), - - _lt = Core._lt, - QWeb = Core.qweb; - -/* HIDE CONTROL PANEL */ -/* FIXME: Look's like a hackish solution */ -ControlPanel.include({ - update: function(status, options) { - if (typeof options === 'undefined') { - options = {}; - } - if (typeof options.toHide === 'undefined') - options.toHide = false; - var action_stack = this.getParent().action_stack; - if (action_stack && action_stack.length) { - var active_action = action_stack[action_stack.length-1]; - if (active_action.widget && active_action.widget.active_view && - active_action.widget.active_view.type === 'mpms'){ - options.toHide = true; - } - } - this._super(status, options); - this._toggle_visibility(!options.toHide); - } -}); - -var MPMSCalendarView = AbstractView.extend({ - display_name: _lt('Calendar MPMS'), - icon: 'fa-calendar', - jsLibs: ['/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js'], - cssLibs: [ - '/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css', - '/hotel_calendar/static/src/lib/hcalendar/css/hcalendar_management.css' - ], - config: { - Model: MPMSCalendarModel, - Controller: MPMSCalendarController, - Renderer: MPMSCalendarRenderer, - }, - - init: function (viewInfo, params) { - this._super.apply(this, arguments); - var arch = viewInfo.arch; - var fields = viewInfo.fields; - var attrs = arch.attrs; - - // If form_view_id is set, then the calendar view will open a form view - // with this id, when it needs to edit or create an event. - this.controllerParams.formViewId = - attrs.form_view_id ? parseInt(attrs.form_view_id, 10) : false; - if (!this.controllerParams.formViewId && params.action) { - var formViewDescr = _.find(params.action.views, function (v) { - return v[1] === 'form'; - }); - if (formViewDescr) { - this.controllerParams.formViewId = formViewDescr[0]; - } - } - - this.controllerParams.readonlyFormViewId = !attrs.readonly_form_view_id || !utils.toBoolElse(attrs.readonly_form_view_id, true) ? false : attrs.readonly_form_view_id; - this.controllerParams.context = params.context || {}; - this.controllerParams.displayName = params.action && params.action.name; - - this.rendererParams.model = viewInfo.model; - - this.loadParams.fields = fields; - this.loadParams.fieldsInfo = viewInfo.fieldsInfo; - this.loadParams.creatable = false; - - this.loadParams.mode = attrs.mode; - }, -}); - -ViewRegistry.add('mpms', MPMSCalendarView); - -return MPMSCalendarView; - -}); diff --git a/hotel_calendar/static/src/js/views/constants.js b/hotel_calendar/static/src/js/views/constants.js deleted file mode 100644 index f52526b83..000000000 --- a/hotel_calendar/static/src/js/views/constants.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.Constants', function (require) { -"use strict"; - - var Core = require('web.core'), - Time = require('web.time'), - - l10n = Core._t.database.parameters; - - return { - ODOO_DATE_MOMENT_FORMAT: 'YYYY-MM-DD', - ODOO_DATETIME_MOMENT_FORMAT: 'YYYY-MM-DD HH:mm:ss', - L10N_DATE_MOMENT_FORMAT: "DD/MM/YYYY", //FIXME: Time.strftime_to_moment_format(l10n.date_format), - L10N_DATETIME_MOMENT_FORMAT: 'DD/MM/YYYY ' + Time.strftime_to_moment_format(l10n.time_format), - - CURRENCY_SYMBOL: "€", - }; - -}); diff --git a/hotel_calendar/static/src/js/widgets/MultiCalendar.js b/hotel_calendar/static/src/js/widgets/MultiCalendar.js deleted file mode 100644 index 086cde1f5..000000000 --- a/hotel_calendar/static/src/js/widgets/MultiCalendar.js +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar.MultiCalendar', function(require) { - 'use strict'; - - var core = require('web.core'); - var session = require('web.session'); - var Widget = require('web.Widget'); - var HotelConstants = require('hotel_calendar.Constants'); - - var QWeb = core.qweb; - - var MultiCalendar = Widget.extend({ - _calendars: [], - _calendar_records: [], - _active_index: -1, - _events: {}, - _tabs: [], - _dataset: {}, - _base: null, - - - init: function(parent) { - this._super.apply(this, arguments); - }, - - start: function() { - this._super.apply(this, arguments); - - this._create_tabs_panel(); - }, - - on: function(event_name, callback) { - this.$el.on(event_name, callback.bind(this)); - }, - - reset: function() { - for (var i in this._calendars) { - delete this._calendars[i]; - } - for (var [$tab, $panel] of this._tabs) { - $tab.remove(); - $panel.remove(); - } - $('#multicalendar_tabs').remove(); - $('#multicalendar_panels').remove(); - this._calendars = []; - this._calendar_records = []; - this._tabs = []; - this._datasets = {}; - this._active_index = -1; - this._events = {}; - }, - - get_calendar: function(index) { - return this._calendars[index-1]; - }, - - get_calendar_record: function(index) { - return this._calendar_records[index-1]; - }, - - get_tab: function(index) { - return this._tabs[index]; - }, - - get_active_index: function() { - return this._active_index; - }, - - get_active_calendar: function() { - return this._calendars[this._active_index-1]; - }, - - get_active_tab: function() { - return this._tabs[this._active_index]; - }, - - update_active_tab_name: function(name) { - var [$tab, $panel] = this.get_tab(this.get_active_index()); - $tab.text(name); - }, - - get_active_filters: function() { - var calendar = this.get_active_calendar(); - var domain = calendar.getDomain(HotelCalendar.DOMAIN.ROOMS); - - var filters = {}; - for (var rule of domain) { - filters[rule[0]] = rule[2]; - } - - return filters; - }, - - recalculate_reservation_positions: function() { - var active_calendar = this.get_active_calendar(); - if (active_calendar) { - setTimeout(function(calendar){ - calendar._updateOffsets(); - calendar._updateReservations(false); - }.bind(this, active_calendar), 200); - } - }, - - remove_reservation: function(reserv_id) { - this._dataset['reservations'] = _.reject(this._dataset['reservations'], {id: reserv_id}); - for (var calendar of this._calendars) { - var reserv = calendar.getReservation(reserv_id); - if (reserv) { - calendar.removeReservation(reserv); - } - } - }, - - remove_extra_room_row: function(reserv, only_active_calendar) { - if (only_active_calendar) { - this.get_active_calendar().removeExtraRoomRow(reserv); - } else { - for (var calendar of this._calendars) { - calendar.removeExtraRoomRow(reserv); - } - } - }, - - swap_reservations: function(outReservs, inReservs) { - for (var calendar of this._calendars) { - calendar.swapReservations(outReservs, inReservs); - } - }, - - set_active_calendar: function(index) { - this._tabs[index+1][0].tab('show'); - }, - - set_datasets: function(pricelist, restrictions, reservations) { - this._dataset = { - pricelist: pricelist, - restrictions: restrictions, - reservations: reservations, - }; - }, - - set_options: function(options) { - this._options = options; - }, - - set_base_element: function(element) { - this._base = element; - }, - - merge_pricelist: function(pricelist, calendar) { - var keys = _.keys(pricelist); - for (var k of keys) { - var pr = pricelist[k]; - for (var pr_k in pr) { - var pr_item = pricelist[k][pr_k]; - var pr_fk = _.findKey(this._dataset['pricelist'][k], {'room': pr_item.room}); - if (pr_fk) { - this._dataset['pricelist'][k][pr_fk].room = pr_item.room; - this._dataset['pricelist'][k][pr_fk].days = _.extend(this._dataset['pricelist'][k][pr_fk].days, pr_item.days); - if (pr_item.title) { - this._dataset['pricelist'][k][pr_fk].title = pr_item.title; - } - } else { - if (!(k in this._dataset['pricelist'])) { - this._dataset['pricelist'][k] = []; - } - this._dataset['pricelist'][k].push({ - 'room': pr_item.room, - 'days': pr_item.days, - 'title': pr_item.title - }); - } - } - } - - if (!calendar) { - for (var calendar of this._calendars) { - calendar.setPricelist(this._dataset['pricelist']); - } - } else { - calendar.setPricelist(this._dataset['pricelist']); - } - }, - - merge_restrictions: function(restrictions, calendar) { - var room_type_ids = Object.keys(restrictions); - for (var vid of room_type_ids) { - if (vid in this._dataset['restrictions']) { - this._dataset['restrictions'][vid] = _.extend(this._dataset['restrictions'][vid], restrictions[vid]); - } - else { - this._dataset['restrictions'][vid] = restrictions[vid]; - } - } - - if (!calendar) { - for (var calendar of this._calendars) { - calendar.setRestrictions(this._dataset['restrictions']); - } - } else { - calendar.setRestrictions(this._dataset['restrictions']); - } - }, - - merge_reservations: function(reservations, calendar) { - for (var r of reservations) { - var rindex = _.findKey(this._dataset['reservations'], {'id': r.id}); - if (rindex) { - this._dataset['reservations'][rindex] = r; - } else { - this._dataset['reservations'].push(r); - } - } - - if (!calendar) { - for (var calendar of this._calendars) { - calendar.addReservations(reservations); - } - } else { - calendar.addReservations(reservations); - } - }, - - merge_days_tooltips: function(new_tooltips) { - for (var nt of new_tooltips) { - var fnt = _.find(this._days_tooltips, function(item) { return item['id'] === nt['id']}); - if (fnt) { - fnt = nt; - } else { - this._days_tooltips.push(nt); - } - } - }, - - create_calendar: function(calendar_record) { - var [$tab, $panel] = this._create_tab(calendar_record['name'], `calendar-pane-${calendar_record['name']}`); - var calendar = new HotelCalendar( - $panel[0], - this._options, - this._dataset['pricelist'], - this._dataset['restrictions'], - this._base); - this._assign_calendar_events(calendar); - this._assign_extra_info(calendar); - calendar.setReservations(this._dataset['reservations']); - this._calendars.push(calendar); - this._calendar_records.push(calendar_record); - return this._calendars.length-1; - }, - - on_calendar: function(event_name, callback) { - this._events[event_name] = callback; - }, - - - _create_tab: function(name, id, options) { - var self = this; - var sanitized_id = this._sanitizeId(id); - - var $tab = $('', _.extend({ - id: this._sanitizeId(name), - href: `#${sanitized_id}`, - text: name, - role: 'tab', - }, options)).data('tabindex', this._tabs.length).appendTo($('
  • ').prependTo(this.$tabs)); - $tab.on('shown.bs.tab', function(ev){ - self._active_index = $(ev.target).data('tabindex'); - self.recalculate_reservation_positions(); - if (ev.relatedTarget) { - var prev_index = $(ev.relatedTarget).data('tabindex'); - if (prev_index) { - self.get_calendar(prev_index).cancelSwap(); - } - } - - self.$el.trigger('tab_changed', [self._active_index]); - }); - $tab[0].dataset.toggle = 'tab'; - var $panel = $('
    ', { - id: sanitized_id, - class: 'tab-pane', - role: 'tabpanel' - }).appendTo(this.$tabs_content); - - this._tabs.push([$tab, $panel]); - return this._tabs[this._tabs.length-1]; - }, - - _create_tabs_panel: function() { - var self = this; - this.$el.empty(); - this.$tabs = $('
      ', { - class: 'nav nav-tabs', - id: 'multicalendar_tabs' - }).appendTo(this.$el); - this.$tabs_content = $('
      ', { - class: 'tab-content', - id: 'multicalendar_panels' - }).appendTo(this.$el); - - // '+' Tab - var [$tab, $panel] = this._create_tab('+', 'default', {class: 'multi-calendar-tab-plus'}); - $tab.on('shown.bs.tab', function(ev){ - ev.preventDefault(); - var calendar_record = { - id: false, - name: `Calendar #${self._calendars.length}`, - segmentation_ids: [], - location_ids: [], - amenity_ids: [], - room_type_ids: [] - }; - var new_calendar_id = self.create_calendar(calendar_record); - self.set_active_calendar(new_calendar_id); - }); - $('

      ', { - class: 'warn-message', - text: "NO CALENDAR DEFINED!", - }).appendTo($panel); - }, - - _assign_calendar_events: function(calendar) { - for (var event_name in this._events) { - calendar.addEventListener(event_name, this._events[event_name]); - } - }, - - _assign_extra_info: function(calendar) { - var self = this; - $(calendar.etable).find('.hcal-cell-room-type-group-item.btn-hcal-left').on("mouseenter", function(){ - var $this = $(this); - var room = calendar.getRoom($this.parent().data("hcalRoomObjId")); - if (room.overbooking) { - $this.tooltip({ - animation: true, - html: true, - placement: 'right', - title: QWeb.render('HotelCalendar.TooltipRoomOverbooking', {'name': room.number}) - }).tooltip('show'); - } else { - var qdict = { - 'room_type_name': room.getUserData('room_type_name'), - 'name': room.number - }; - $this.tooltip({ - animation: true, - html: true, - placement: 'right', - title: QWeb.render('HotelCalendar.TooltipRoom', qdict) - }).tooltip('show'); - } - }); - - $(calendar.etableHeader).find('.hcal-cell-header-day').each(function(index, elm){ - var $elm = $(elm); - var cdate = HotelCalendar.toMoment($elm.data('hcalDate'), HotelConstants.L10N_DATE_MOMENT_FORMAT); - var data = _.filter(self._days_tooltips, function(item) { - var ndate = HotelCalendar.toMoment(item['date'], HotelConstants.ODOO_DATE_MOMENT_FORMAT); - return ndate.isSame(cdate, 'd'); - }); - if (data.length > 0) { - $elm.addClass('hcal-event-day'); - $elm.append(""); - $elm.on("mouseenter", function(data){ - var $this = $(this); - if (data.length > 0) { - var qdict = { - 'date': $this.data('hcalDate'), - 'events': _.map(data, function(item){ - return { - 'name': item['name'], - 'date': item['date'], - 'location': item['location'] - }; - }) - }; - $this.attr('title', ''); - $this.tooltip({ - animation: true, - html: true, - placement: 'bottom', - title: QWeb.render('HotelCalendar.TooltipEvent', qdict) - }).tooltip('show'); - } - }.bind(elm, data)); - } - }); - }, - - _sanitizeId: function(/*String*/str) { - return str.replace(/[^a-zA-Z0-9\-_]/g, '_'); - }, - }); - - return MultiCalendar; -}); diff --git a/hotel_calendar/static/src/lib/bootbox.js b/hotel_calendar/static/src/lib/bootbox.js deleted file mode 100644 index 3e8312a85..000000000 --- a/hotel_calendar/static/src/lib/bootbox.js +++ /dev/null @@ -1,985 +0,0 @@ -/** - * bootbox.js [v4.4.0] - * - * http://bootboxjs.com/license.txt - */ - -// @see https://github.com/makeusabrew/bootbox/issues/180 -// @see https://github.com/makeusabrew/bootbox/issues/186 -(function (root, factory) { - - "use strict"; - if (typeof define === "function" && define.amd) { - // AMD. Register as an anonymous module. - define(["jquery"], factory); - } else if (typeof exports === "object") { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(require("jquery")); - } else { - // Browser globals (root is window) - root.bootbox = factory(root.jQuery); - } - -}(this, function init($, undefined) { - - "use strict"; - - // the base DOM structure needed to create a modal - var templates = { - dialog: - "

      ", - header: - "", - footer: - "", - closeButton: - "", - form: - "
      ", - inputs: { - text: - "", - textarea: - "", - email: - "", - select: - "", - checkbox: - "
      ", - date: - "", - time: - "", - number: - "", - password: - "" - } - }; - - var defaults = { - // default language - locale: "en", - // show backdrop or not. Default to static so user has to interact with dialog - backdrop: "static", - // animate the modal in/out - animate: true, - // additional class string applied to the top level dialog - className: null, - // whether or not to include a close button - closeButton: true, - // show the dialog immediately by default - show: true, - // dialog container - container: "body" - }; - - // our public object; augmented after our private API - var exports = {}; - - /** - * @private - */ - function _t(key) { - var locale = locales[defaults.locale]; - return locale ? locale[key] : locales.en[key]; - } - - function processCallback(e, dialog, callback) { - e.stopPropagation(); - e.preventDefault(); - - // by default we assume a callback will get rid of the dialog, - // although it is given the opportunity to override this - - // so, if the callback can be invoked and it *explicitly returns false* - // then we'll set a flag to keep the dialog active... - var preserveDialog = $.isFunction(callback) && callback.call(dialog, e) === false; - - // ... otherwise we'll bin it - if (!preserveDialog) { - dialog.modal("hide"); - } - } - - function getKeyLength(obj) { - // @TODO defer to Object.keys(x).length if available? - var k, t = 0; - for (k in obj) { - t ++; - } - return t; - } - - function each(collection, iterator) { - var index = 0; - $.each(collection, function(key, value) { - iterator(key, value, index++); - }); - } - - function sanitize(options) { - var buttons; - var total; - - if (typeof options !== "object") { - throw new Error("Please supply an object of options"); - } - - if (!options.message) { - throw new Error("Please specify a message"); - } - - // make sure any supplied options take precedence over defaults - options = $.extend({}, defaults, options); - - if (!options.buttons) { - options.buttons = {}; - } - - buttons = options.buttons; - - total = getKeyLength(buttons); - - each(buttons, function(key, button, index) { - - if ($.isFunction(button)) { - // short form, assume value is our callback. Since button - // isn't an object it isn't a reference either so re-assign it - button = buttons[key] = { - callback: button - }; - } - - // before any further checks make sure by now button is the correct type - if ($.type(button) !== "object") { - throw new Error("button with key " + key + " must be an object"); - } - - if (!button.label) { - // the lack of an explicit label means we'll assume the key is good enough - button.label = key; - } - - if (!button.className) { - if (total <= 2 && index === total-1) { - // always add a primary to the main option in a two-button dialog - button.className = "btn-primary"; - } else { - button.className = "btn-default"; - } - } - }); - - return options; - } - - /** - * map a flexible set of arguments into a single returned object - * if args.length is already one just return it, otherwise - * use the properties argument to map the unnamed args to - * object properties - * so in the latter case: - * mapArguments(["foo", $.noop], ["message", "callback"]) - * -> { message: "foo", callback: $.noop } - */ - function mapArguments(args, properties) { - var argn = args.length; - var options = {}; - - if (argn < 1 || argn > 2) { - throw new Error("Invalid argument length"); - } - - if (argn === 2 || typeof args[0] === "string") { - options[properties[0]] = args[0]; - options[properties[1]] = args[1]; - } else { - options = args[0]; - } - - return options; - } - - /** - * merge a set of default dialog options with user supplied arguments - */ - function mergeArguments(defaults, args, properties) { - return $.extend( - // deep merge - true, - // ensure the target is an empty, unreferenced object - {}, - // the base options object for this type of dialog (often just buttons) - defaults, - // args could be an object or array; if it's an array properties will - // map it to a proper options object - mapArguments( - args, - properties - ) - ); - } - - /** - * this entry-level method makes heavy use of composition to take a simple - * range of inputs and return valid options suitable for passing to bootbox.dialog - */ - function mergeDialogOptions(className, labels, properties, args) { - // build up a base set of dialog properties - var baseOptions = { - className: "bootbox-" + className, - buttons: createLabels.apply(null, labels) - }; - - // ensure the buttons properties generated, *after* merging - // with user args are still valid against the supplied labels - return validateButtons( - // merge the generated base properties with user supplied arguments - mergeArguments( - baseOptions, - args, - // if args.length > 1, properties specify how each arg maps to an object key - properties - ), - labels - ); - } - - /** - * from a given list of arguments return a suitable object of button labels - * all this does is normalise the given labels and translate them where possible - * e.g. "ok", "confirm" -> { ok: "OK, cancel: "Annuleren" } - */ - function createLabels() { - var buttons = {}; - - for (var i = 0, j = arguments.length; i < j; i++) { - var argument = arguments[i]; - var key = argument.toLowerCase(); - var value = argument.toUpperCase(); - - buttons[key] = { - label: _t(value) - }; - } - - return buttons; - } - - function validateButtons(options, buttons) { - var allowedButtons = {}; - each(buttons, function(key, value) { - allowedButtons[value] = true; - }); - - each(options.buttons, function(key) { - if (allowedButtons[key] === undefined) { - throw new Error("button key " + key + " is not allowed (options are " + buttons.join("\n") + ")"); - } - }); - - return options; - } - - exports.alert = function() { - var options; - - options = mergeDialogOptions("alert", ["ok"], ["message", "callback"], arguments); - - if (options.callback && !$.isFunction(options.callback)) { - throw new Error("alert requires callback property to be a function when provided"); - } - - /** - * overrides - */ - options.buttons.ok.callback = options.onEscape = function() { - if ($.isFunction(options.callback)) { - return options.callback.call(this); - } - return true; - }; - - return exports.dialog(options); - }; - - exports.confirm = function() { - var options; - - options = mergeDialogOptions("confirm", ["cancel", "confirm"], ["message", "callback"], arguments); - - /** - * overrides; undo anything the user tried to set they shouldn't have - */ - options.buttons.cancel.callback = options.onEscape = function() { - return options.callback.call(this, false); - }; - - options.buttons.confirm.callback = function() { - return options.callback.call(this, true); - }; - - // confirm specific validation - if (!$.isFunction(options.callback)) { - throw new Error("confirm requires a callback"); - } - - return exports.dialog(options); - }; - - exports.prompt = function() { - var options; - var defaults; - var dialog; - var form; - var input; - var shouldShow; - var inputOptions; - - // we have to create our form first otherwise - // its value is undefined when gearing up our options - // @TODO this could be solved by allowing message to - // be a function instead... - form = $(templates.form); - - // prompt defaults are more complex than others in that - // users can override more defaults - // @TODO I don't like that prompt has to do a lot of heavy - // lifting which mergeDialogOptions can *almost* support already - // just because of 'value' and 'inputType' - can we refactor? - defaults = { - className: "bootbox-prompt", - buttons: createLabels("cancel", "confirm"), - value: "", - inputType: "text" - }; - - options = validateButtons( - mergeArguments(defaults, arguments, ["title", "callback"]), - ["cancel", "confirm"] - ); - - // capture the user's show value; we always set this to false before - // spawning the dialog to give us a chance to attach some handlers to - // it, but we need to make sure we respect a preference not to show it - shouldShow = (options.show === undefined) ? true : options.show; - - /** - * overrides; undo anything the user tried to set they shouldn't have - */ - options.message = form; - - options.buttons.cancel.callback = options.onEscape = function() { - return options.callback.call(this, null); - }; - - options.buttons.confirm.callback = function() { - var value; - - switch (options.inputType) { - case "text": - case "textarea": - case "email": - case "select": - case "date": - case "time": - case "number": - case "password": - value = input.val(); - break; - - case "checkbox": - var checkedItems = input.find("input:checked"); - - // we assume that checkboxes are always multiple, - // hence we default to an empty array - value = []; - - each(checkedItems, function(_, item) { - value.push($(item).val()); - }); - break; - } - - return options.callback.call(this, value); - }; - - options.show = false; - - // prompt specific validation - if (!options.title) { - throw new Error("prompt requires a title"); - } - - if (!$.isFunction(options.callback)) { - throw new Error("prompt requires a callback"); - } - - if (!templates.inputs[options.inputType]) { - throw new Error("invalid prompt type"); - } - - // create the input based on the supplied type - input = $(templates.inputs[options.inputType]); - - switch (options.inputType) { - case "text": - case "textarea": - case "email": - case "date": - case "time": - case "number": - case "password": - input.val(options.value); - break; - - case "select": - var groups = {}; - inputOptions = options.inputOptions || []; - - if (!$.isArray(inputOptions)) { - throw new Error("Please pass an array of input options"); - } - - if (!inputOptions.length) { - throw new Error("prompt with select requires options"); - } - - each(inputOptions, function(_, option) { - - // assume the element to attach to is the input... - var elem = input; - - if (option.value === undefined || option.text === undefined) { - throw new Error("given options in wrong format"); - } - - // ... but override that element if this option sits in a group - - if (option.group) { - // initialise group if necessary - if (!groups[option.group]) { - groups[option.group] = $("").attr("label", option.group); - } - - elem = groups[option.group]; - } - - elem.append(""); - }); - - each(groups, function(_, group) { - input.append(group); - }); - - // safe to set a select's value as per a normal input - input.val(options.value); - break; - - case "checkbox": - var values = $.isArray(options.value) ? options.value : [options.value]; - inputOptions = options.inputOptions || []; - - if (!inputOptions.length) { - throw new Error("prompt with checkbox requires options"); - } - - if (!inputOptions[0].value || !inputOptions[0].text) { - throw new Error("given options in wrong format"); - } - - // checkboxes have to nest within a containing element, so - // they break the rules a bit and we end up re-assigning - // our 'input' element to this container instead - input = $("
      "); - - each(inputOptions, function(_, option) { - var checkbox = $(templates.inputs[options.inputType]); - - checkbox.find("input").attr("value", option.value); - checkbox.find("label").append(option.text); - - // we've ensured values is an array so we can always iterate over it - each(values, function(_, value) { - if (value === option.value) { - checkbox.find("input").prop("checked", true); - } - }); - - input.append(checkbox); - }); - break; - } - - // @TODO provide an attributes option instead - // and simply map that as keys: vals - if (options.placeholder) { - input.attr("placeholder", options.placeholder); - } - - if (options.pattern) { - input.attr("pattern", options.pattern); - } - - if (options.maxlength) { - input.attr("maxlength", options.maxlength); - } - - // now place it in our form - form.append(input); - - form.on("submit", function(e) { - e.preventDefault(); - // Fix for SammyJS (or similar JS routing library) hijacking the form post. - e.stopPropagation(); - // @TODO can we actually click *the* button object instead? - // e.g. buttons.confirm.click() or similar - dialog.find(".btn-primary").click(); - }); - - dialog = exports.dialog(options); - - // clear the existing handler focusing the submit button... - dialog.off("shown.bs.modal"); - - // ...and replace it with one focusing our input, if possible - dialog.on("shown.bs.modal", function() { - // need the closure here since input isn't - // an object otherwise - input.focus(); - }); - - if (shouldShow === true) { - dialog.modal("show"); - } - - return dialog; - }; - - exports.dialog = function(options) { - options = sanitize(options); - - var dialog = $(templates.dialog); - var innerDialog = dialog.find(".modal-dialog"); - var body = dialog.find(".modal-body"); - var buttons = options.buttons; - var buttonStr = ""; - var callbacks = { - onEscape: options.onEscape - }; - - if ($.fn.modal === undefined) { - throw new Error( - "$.fn.modal is not defined; please double check you have included " + - "the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ " + - "for more details." - ); - } - - each(buttons, function(key, button) { - - // @TODO I don't like this string appending to itself; bit dirty. Needs reworking - // can we just build up button elements instead? slower but neater. Then button - // can just become a template too - buttonStr += ""; - callbacks[key] = button.callback; - }); - - body.find(".bootbox-body").html(options.message); - - if (options.animate === true) { - dialog.addClass("fade"); - } - - if (options.className) { - dialog.addClass(options.className); - } - - if (options.size === "large") { - innerDialog.addClass("modal-lg"); - } else if (options.size === "small") { - innerDialog.addClass("modal-sm"); - } - - if (options.title) { - body.before(templates.header); - } - - if (options.closeButton) { - var closeButton = $(templates.closeButton); - - if (options.title) { - dialog.find(".modal-header").prepend(closeButton); - } else { - closeButton.css("margin-top", "-10px").prependTo(body); - } - } - - if (options.title) { - dialog.find(".modal-title").html(options.title); - } - - if (buttonStr.length) { - body.after(templates.footer); - dialog.find(".modal-footer").html(buttonStr); - } - - - /** - * Bootstrap event listeners; used handle extra - * setup & teardown required after the underlying - * modal has performed certain actions - */ - - dialog.on("hidden.bs.modal", function(e) { - // ensure we don't accidentally intercept hidden events triggered - // by children of the current dialog. We shouldn't anymore now BS - // namespaces its events; but still worth doing - if (e.target === this) { - dialog.remove(); - } - }); - - /* - dialog.on("show.bs.modal", function() { - // sadly this doesn't work; show is called *just* before - // the backdrop is added so we'd need a setTimeout hack or - // otherwise... leaving in as would be nice - if (options.backdrop) { - dialog.next(".modal-backdrop").addClass("bootbox-backdrop"); - } - }); - */ - - dialog.on("shown.bs.modal", function() { - dialog.find(".btn-primary:first").focus(); - }); - - /** - * Bootbox event listeners; experimental and may not last - * just an attempt to decouple some behaviours from their - * respective triggers - */ - - if (options.backdrop !== "static") { - // A boolean true/false according to the Bootstrap docs - // should show a dialog the user can dismiss by clicking on - // the background. - // We always only ever pass static/false to the actual - // $.modal function because with `true` we can't trap - // this event (the .modal-backdrop swallows it) - // However, we still want to sort of respect true - // and invoke the escape mechanism instead - dialog.on("click.dismiss.bs.modal", function(e) { - // @NOTE: the target varies in >= 3.3.x releases since the modal backdrop - // moved *inside* the outer dialog rather than *alongside* it - if (dialog.children(".modal-backdrop").length) { - e.currentTarget = dialog.children(".modal-backdrop").get(0); - } - - if (e.target !== e.currentTarget) { - return; - } - - dialog.trigger("escape.close.bb"); - }); - } - - dialog.on("escape.close.bb", function(e) { - if (callbacks.onEscape) { - processCallback(e, dialog, callbacks.onEscape); - } - }); - - /** - * Standard jQuery event listeners; used to handle user - * interaction with our dialog - */ - - dialog.on("click", ".modal-footer button", function(e) { - var callbackKey = $(this).data("bb-handler"); - - processCallback(e, dialog, callbacks[callbackKey]); - }); - - dialog.on("click", ".bootbox-close-button", function(e) { - // onEscape might be falsy but that's fine; the fact is - // if the user has managed to click the close button we - // have to close the dialog, callback or not - processCallback(e, dialog, callbacks.onEscape); - }); - - dialog.on("keyup", function(e) { - if (e.which === 27) { - dialog.trigger("escape.close.bb"); - } - }); - - // the remainder of this method simply deals with adding our - // dialogent to the DOM, augmenting it with Bootstrap's modal - // functionality and then giving the resulting object back - // to our caller - - $(options.container).append(dialog); - - dialog.modal({ - backdrop: options.backdrop ? "static": false, - keyboard: false, - show: false - }); - - if (options.show) { - dialog.modal("show"); - } - - // @TODO should we return the raw element here or should - // we wrap it in an object on which we can expose some neater - // methods, e.g. var d = bootbox.alert(); d.hide(); instead - // of d.modal("hide"); - - /* - function BBDialog(elem) { - this.elem = elem; - } - - BBDialog.prototype = { - hide: function() { - return this.elem.modal("hide"); - }, - show: function() { - return this.elem.modal("show"); - } - }; - */ - - return dialog; - - }; - - exports.setDefaults = function() { - var values = {}; - - if (arguments.length === 2) { - // allow passing of single key/value... - values[arguments[0]] = arguments[1]; - } else { - // ... and as an object too - values = arguments[0]; - } - - $.extend(defaults, values); - }; - - exports.hideAll = function() { - $(".bootbox").modal("hide"); - - return exports; - }; - - - /** - * standard locales. Please add more according to ISO 639-1 standard. Multiple language variants are - * unlikely to be required. If this gets too large it can be split out into separate JS files. - */ - var locales = { - bg_BG : { - OK : "Ок", - CANCEL : "Отказ", - CONFIRM : "Потвърждавам" - }, - br : { - OK : "OK", - CANCEL : "Cancelar", - CONFIRM : "Sim" - }, - cs : { - OK : "OK", - CANCEL : "Zrušit", - CONFIRM : "Potvrdit" - }, - da : { - OK : "OK", - CANCEL : "Annuller", - CONFIRM : "Accepter" - }, - de : { - OK : "OK", - CANCEL : "Abbrechen", - CONFIRM : "Akzeptieren" - }, - el : { - OK : "Εντάξει", - CANCEL : "Ακύρωση", - CONFIRM : "Επιβεβαίωση" - }, - en : { - OK : "OK", - CANCEL : "Cancel", - CONFIRM : "OK" - }, - es : { - OK : "OK", - CANCEL : "Cancelar", - CONFIRM : "Aceptar" - }, - et : { - OK : "OK", - CANCEL : "Katkesta", - CONFIRM : "OK" - }, - fa : { - OK : "قبول", - CANCEL : "لغو", - CONFIRM : "تایید" - }, - fi : { - OK : "OK", - CANCEL : "Peruuta", - CONFIRM : "OK" - }, - fr : { - OK : "OK", - CANCEL : "Annuler", - CONFIRM : "D'accord" - }, - he : { - OK : "אישור", - CANCEL : "ביטול", - CONFIRM : "אישור" - }, - hu : { - OK : "OK", - CANCEL : "Mégsem", - CONFIRM : "Megerősít" - }, - hr : { - OK : "OK", - CANCEL : "Odustani", - CONFIRM : "Potvrdi" - }, - id : { - OK : "OK", - CANCEL : "Batal", - CONFIRM : "OK" - }, - it : { - OK : "OK", - CANCEL : "Annulla", - CONFIRM : "Conferma" - }, - ja : { - OK : "OK", - CANCEL : "キャンセル", - CONFIRM : "確認" - }, - lt : { - OK : "Gerai", - CANCEL : "Atšaukti", - CONFIRM : "Patvirtinti" - }, - lv : { - OK : "Labi", - CANCEL : "Atcelt", - CONFIRM : "Apstiprināt" - }, - nl : { - OK : "OK", - CANCEL : "Annuleren", - CONFIRM : "Accepteren" - }, - no : { - OK : "OK", - CANCEL : "Avbryt", - CONFIRM : "OK" - }, - pl : { - OK : "OK", - CANCEL : "Anuluj", - CONFIRM : "Potwierdź" - }, - pt : { - OK : "OK", - CANCEL : "Cancelar", - CONFIRM : "Confirmar" - }, - ru : { - OK : "OK", - CANCEL : "Отмена", - CONFIRM : "Применить" - }, - sq : { - OK : "OK", - CANCEL : "Anulo", - CONFIRM : "Prano" - }, - sv : { - OK : "OK", - CANCEL : "Avbryt", - CONFIRM : "OK" - }, - th : { - OK : "ตกลง", - CANCEL : "ยกเลิก", - CONFIRM : "ยืนยัน" - }, - tr : { - OK : "Tamam", - CANCEL : "İptal", - CONFIRM : "Onayla" - }, - zh_CN : { - OK : "OK", - CANCEL : "取消", - CONFIRM : "确认" - }, - zh_TW : { - OK : "OK", - CANCEL : "取消", - CONFIRM : "確認" - } - }; - - exports.addLocale = function(name, values) { - $.each(["OK", "CANCEL", "CONFIRM"], function(_, v) { - if (!values[v]) { - throw new Error("Please supply a translation for '" + v + "'"); - } - }); - - locales[name] = { - OK: values.OK, - CANCEL: values.CANCEL, - CONFIRM: values.CONFIRM - }; - - return exports; - }; - - exports.removeLocale = function(name) { - delete locales[name]; - - return exports; - }; - - exports.setLocale = function(name) { - return exports.setDefaults("locale", name); - }; - - exports.init = function(_$) { - return init(_$ || $); - }; - - return exports; -})); diff --git a/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css b/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css deleted file mode 100644 index 6543527bf..000000000 --- a/hotel_calendar/static/src/lib/hcalendar/css/hcalendar.css +++ /dev/null @@ -1,537 +0,0 @@ -/* - * Hotel Calendar JS v0.0.1a - 2017-2018 - * GNU Public License - * Aloxa Solucions S.L. - * Alexandre Díaz - */ - - -/** ANIMATIONS **/ -@keyframes cell-invalid { - 0% { - background: #ff0000; - background: repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - background: -webkit-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - background: -moz-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - } - 50% { - background: #ff0000; - background: repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - background: -webkit-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 35%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - background: -moz-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 40%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - } - 100% { - background: #ff0000; - background: repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 30%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - background: -webkit-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 30%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - background: -moz-repeating-linear-gradient(141deg,#ff0000 10%, #ff0000 30%, rgba(255,0,0,0.51) 30%, rgba(255,0,0,0.51) 50%); - } -} - -#hcal_load { - width: 100%; - height: 90vh; - text-align: center; - line-height: 90vh; - color: darkgray; -} -#hcal_load > span { - line-height: 24px; - display: inline-block; - vertical-align: middle; -} - -#cal-pag-prev-plus, #cal-pag-prev, #cal-pag-selector, #cal-pag-next, #cal-pag-next-plus { - min-height: 0px; -} - -.hcalendar-container { - display: flex; - flex-flow: column; -} - -.table-reservations-header { - order: 1; - flex-grow: 1; - overflow-y: scroll; - overflow-x: hidden; -} -.table-reservations { - order: 2; - flex-grow: 2; - overflow-y: scroll; - overflow-x: hidden; - position: relative; - max-height: 57vh; -} -.table-calcs-header { - order: 3; - flex-grow: 1; - overflow-y: scroll; - overflow-x: hidden; -} -.table-calcs { - order: 4; - flex-grow: 2; - overflow-y: scroll; - overflow-x: hidden; - font-size: 12px; - max-height: 20vh; -} -.table-calcs input, .table-reservations-header input { - border-radius: 0; - border: 1px solid lightgray; - width: 100%; -} -.table-calcs input { - text-align: center; -} - -.btn-hcal { } -.btn-hcal.hcal-cell-current-day { - background-color: #7c7bad66; - color: #654a37; -} -.btn-hcal.hcal-cell-end-week { - background-color: #EDEDED83; -} -.btn-hcal-3d { - border: 1px solid #eaeaea; - border-top-width: 0; - border-bottom-width: 0; - /*border-color: white black black white !important;*/ -} -.btn-hcal-flat { - background-color: white; - border: 1px solid #eaeaea; -} -.btn-hcal-left { - background-color: white; - border: 1px solid #eaeaea; - border-left-width: 0; -} - -.hcal-warn-ob-indicator { - position: absolute; - background-color: red; - color: yellow; - border: 1px solid black; - z-index: 9; - width: 25px; - height: 20px; - text-align: center; -} - -.table-calcs-header .hcal-table, .table-reservations-header .hcal-table { - height: 46px; -} - -.hcal-table, .hcal-table-day { - border-collapse: initial !important; - width: 100%; - table-layout: fixed; -} -.hcal-table > tbody { - max-height: 50vh; - overflow: scroll; -} -.hcal-table td { - text-align: center; - min-width: 100px; - white-space: nowrap; - overflow: hidden; -} -.hcal-table a { - text-decoration: none; -} -.hcal-table tr:hover td:not(.hcal-unused-zone):not(.hcal-cell-highlight):not(.hcal-cell-current-day):not(.hcal-cell-end-week):not(.btn-hcal):not(.hcal-cell-invalid) { - /*background-color: #F6F6F6; - border: 5px solid red;*/ -} - -.hcal-table tr:hover td.hcal-cell-room-type-group-item { - background-color: #7c7bad80; - color: white; -} - -.hcal-restriction-room-day { - background-color: #9b18704d !important; -} - -.hcal-table-day { - height: 100%; - border-collapse: collapse !important; - border: 0 dotted #eaeaea; - border-width: 1px 0; -} -/*.hcal-table-day tr:first-child td{ - border: 1px solid #727272 !important; - border-width: 0 1px 0 0 !important; -} -.hcal-table tr:not(:last-child) .hcal-table-day tr:last-child td { - border-style: solid; - border-color: #727272 !important; - border-bottom-width: 1px !important; -} -.hcal-table-day tr:not(:last-child):not(:first-child) td { - border-width: 0; -}*/ -.hcal-table-day td { - padding: 2px; - height: 3em; - font-size: 7px; - vertical-align: middle; - font-weight: bold; - border: 0.5px solid #eaeaea !important; -} -.hcal-table-day td:hover:not(.hcal-cell-highlight):not(.hcal-cell-invalid) { - background-color: #FCFEE1 !important; -} - -.hcal-cell-current-day { - background-color: #7C7BADA5; -} -.hcal-cell-end-week { - background-color: #EDEDED83; -} - -.hcal-cell-day-selector { - text-align: center; - vertical-align: center; - max-width: 140px; -} -.hcal-cell-day-selector a { - font-size: 22px; - padding: 0 0.5em; -} -.hcal-cell-day-selector span { - cursor: pointer; -} -.hcal-cell-day-selector input { - border: 1px solid lightgray; - width: 120px; - font-size: large; - text-align: center; -} - -.hcal-cell-month { - overflow: hidden; - max-width: 0; - text-align: center !important; - vertical-align: middle; - white-space: nowrap; - font-size: 12px; -} -.hcal-cell-month:nth-child(n+3) { - border-left-width: 2px !important; -} - -.hcal-cell-start-month { - border-left-width: 2px !important; -} - -.hcal-room-type:hover { - cursor:pointer; -} - -.hcal-cell-highlight { - background-color: #F8FD9C; -} - -.hcal-cell-invalid { - background-color: #e58e92; -} - - -.hcal-cell-room-type-group-item-day { - padding: 0 !important; - height: 100%; -} - -.hcal-input-changed { - background-color: rgb(237,110,110); - border: 1px solid gray; -} - -.hcal-cell-room-type-group-item-day-occupied { - /*background-color: #227eaf;*/ -} -.hcal-cell-room-type-group-item-day-occupied[data-hcal-reservation-cell-type=soft-start] { - background-color: #729fcf; - /*border: 2px solid #3465a4;*/ -} - -.hcal-cell-pagination button { - padding: 0.1em; - border-radius: 0; - background-color: initial; -} - -#btn_save_changes.need-save { - color: yellow; - background: orange; -} - -.hcal-hidden { - display: none; -} - -.hcal-reservation-unselect { - opacity: 0.3; - pointer-events: none; -} - -.hcal-reservation { - position: absolute; - text-align: center; - /*background-color: #729fcf;*/ - /*transform: skewX(-25deg);*/ - /*border-radius: 5px;*/ - border: 0 double #3465a4; - color: white; - white-space: nowrap; - overflow: hidden; - z-index: 8; -} -.hcal-reservation:hover { - background-color: #4e97bf; -} -.hcal-reservation span { - position: relative; -} - -.hcal-reservation-splitted { - border-width: 0 6px; - border-style: solid; -} - -.hcal-reservation-invalid { - background-color: #c8543b !important; - border-color: #6c3624 !important; -} -.hcal-reservation-invalid:hover { - background-color: #f5b595 !important; - border-color: #c8543b !important; -} - -.hcal-reservation-foreground { - pointer-events: none; - opacity: 0.9; - color: transparent !important; - background: repeating-linear-gradient( - 45deg, - #606dbc, - #606dbc 10px, - #465298 10px, - #465298 20px - ); -} - -.hcal-reservation-invalid-swap { - pointer-events: none; - opacity: 0.9; - color: transparent !important; - background: repeating-linear-gradient( - 45deg, - #BA6359, - #BA6359 10px, - #dfe066 10px, - #dfe066 20px - ); -} - -.hcal-reservation-invalid-unify { - pointer-events: none; - opacity: 0.9; - color: transparent !important; - background: repeating-linear-gradient( - 45deg, - #BA6359, - #BA6359 10px, - #dfe066 10px, - #dfe066 20px - ); -} - -.hcal-reservation-action { - border: 2px dashed #3465a4; - opacity: 0.9; - pointer-events: none; - z-index:10; -} - -.hcal-reservation-readonly:not(.hcal-unused-zone) { - border: 2px solid #99995b; - color: white !important; - font-weight: bold; - background: #ffee00; - background: repeating-radial-gradient(circle farthest-corner at right center, #ffee00 0%, #2c2c2c 5%, #ffff00 10%, #2c2c2c 20%, #2c2c2c 100%); - background: -webkit-repeating-radial-gradient(circle farthest-corner at right center, #ffee00 0%, #2c2c2c 5%, #ffff00 10%, #2c2c2c 20%, #2c2c2c 100%); - background: -moz-repeating-radial-gradient(circle farthest-corner at right center, #ffee00 0%, #2c2c2c 5%, #ffff00 10%, #2c2c2c 20%, #2c2c2c 100%); -} - -.hcal-reservation-unify-selected { - background-color: #005B96 !important; - border-color: #99bdd5 !important; -} - -.hcal-reservation-swap-in-selected { - background-color: #005B96 !important; - border-color: #99bdd5 !important; -} - -.hcal-reservation-swap-out-selected { - border-color: #005B96 !important; - background-color: #99bdd5 !important; -} - -.hcal-reservation-unify-selected { - background-color: #005B96 !important; - border-color: #99bdd5 !important; -} - -.hcal-reservation-to-divide { - pointer-events: none; -} - -.hcal-reservation-divide-l { - background-color: transparent; - border: 2px dashed black; - cursor: copy; - pointer-events: none; - border-color: black; - border-right-style: solid; - position: absolute; - z-index: 9; -} - -.hcal-reservation-divide-r { - background-color: transparent; - border: 2px dashed black; - cursor: copy; - pointer-events: none; - border-color: black; - border-left-style: solid; - position: absolute; - z-index: 9; -} - -.hcal-row-room-type-group-item { - text-align: center; -} - -tr.hcal-row-room-type-group-overbooking-item td { - background-color: #fccc9f; -} - -tr.hcal-row-room-type-group-cancelled-item td { - background-color: #fcebeb; -} - -.hcal-cell-month-day { - text-align: center !important; -} - -.hcal-cell-room-type-group-day { - text-align: center !important; -} - -.hcal-table-type-group-day { - border-collapse: collapse; - width:100%; -} -.hcal-table-type-group-day td { - border-width: 0; -} -.hcal-table-type-group-day tr:not(:last-child) td { - border-bottom-width: 1px; -} - -.hcal-cell-room-type { - cursor: pointer; -} -td.hcal-cell-room-type { - border-right-width: 2px; -} - -td.hcal-cell-room-type-group-day, td.hcal-cell-room-type { - border-top-width: 2px; -} -td.hcal-cell-room-type-group-day { - padding: 0; -} - -td.hcal-cell-room-type-group-item { - text-align: center !important; - vertical-align: middle; - font-size: smaller; - white-space: nowrap; - text-overflow: ellipsis; -} -td.hcal-cell-room-type-group-item:last-child { - border-right-width: 2px; -} - -.hcal-cell-type-group-day-free { - text-align: center; - font-weight: bold; - padding: 0 !important; -} -.hcal-cell-type-group-day-price { - text-align: center; -} - -td.hcal-cell-header-day { - padding: 0; - vertical-align: middle; - font-size: 10px; -} - -td.hcal-cell-month-day-occupied { - padding: 0; - text-align: center; -} - -.hcal-cell-detail-room-free-type-group-item-day, -.hcal-cell-detail-room-free-total-group-item-day, -.hcal-cell-detail-room-perc-occup-group-item-day, -.hcal-cell-detail-room-price-type-group-item-day, -.hcal-cell-detail-room-min-stay-group-item-day { - border: 1px solid lightgray; -} -.hcal-cell-detail-room-min-stay-group-item-day { - border-color: #307CB0 lightgray lightgray lightgray; - border-width: 2px 1px 1px 1px; -} - -.hcal-cell-detail-room-group-item { - white-space: nowrap; - text-align: right !important; - text-overflow: '...'; -} - -/* FIXME: Workaround for work with other currencies */ -.hcal-cell-detail-room-group-item[data-currency-symbol='€'] { - text-overflow: '... €'; -} - -.hcal-unused-zone { - border-radius: 0px; -} - -.input-price { - width: 100%; - border-style: none !important; - border-radius: 0 !important; - text-align: center; -} - -.noselect { - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Safari */ - -khtml-user-select: none; /* Konqueror HTML */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; /* Non-prefixed version, currently - supported by Chrome and Opera */ -} diff --git a/hotel_calendar/static/src/lib/hcalendar/css/hcalendar_management.css b/hotel_calendar/static/src/lib/hcalendar/css/hcalendar_management.css deleted file mode 100644 index 74bfe841d..000000000 --- a/hotel_calendar/static/src/lib/hcalendar/css/hcalendar_management.css +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Hotel Calendar Management JS v0.0.1a - 2017 - * GNU Public License - * Aloxa Solucions S.L. - * Alexandre Díaz - */ - - #pms-search-cal-pag { - text-align: center; - } - -#mpms-search { - padding: 0.5em; -} - -.hcal-management-table, .hcal-management-table-day { - border-collapse: collapse !important; - table-layout: fixed; -} -.hcal-management-table > tbody { - max-height: 50vh; - overflow: scroll; -} -.hcal-management-table > thead > tr > td { - /*text-align: center !important;*/ - width: 110px !important; - vertical-align: center; - min-width: 110px; - height: 1.5em; - min-height: 1.5em; - white-space: nowrap; - /*overflow: hidden;*/ - border: 1px solid black !important; -} -.hcal-management-table > tbody > tr > td { - /*text-align: center !important;*/ - width: 110px !important; - vertical-align: center; - min-width: 110px; - height: 130px; - min-height: 100px; - white-space: nowrap; - /*overflow: hidden;*/ - padding: 5px !important; - border: 1px solid black; -} -.hcal-management-table thead td { - text-align: center !important; -} -.hcal-management-table a { - text-decoration: none; -} -.hcal-management-table tr:hover td:not(.hcal-cell-highlight):not(.hcal-cell-current-day):not(.hcal-cell-end-week):not(.btn-hcal):not(.hcal-cell-invalid) { - background-color: #F6F6F6; -} - -.hcal-management-table tr:hover td.hcal-cell-room-type-group-item { - background-color: #9bcd9b; - color: black; -} - -.hcal-management-table input[type='edit'] { - width: 100%; - font-size: 10px; - text-align: center; -} -.hcal-management-table select { - font-size: 9px; -} - -.hcal-management-table-day { - height: 100%; - border-collapse: collapse !important; -} -.hcal-management-table-day td { - padding: 2px; - height: 2.3em; - font-size: 7px; - vertical-align: middle; - font-weight: bold; - border: 0; -} -.hcal-management-table-day td:hover:not(.hcal-cell-highlight):not(.hcal-cell-invalid) { - background-color: #FCFEE1 !important; -} - -.hcal-management-low > tbody > tr > td, .hcal-management-low > table > tbody > tr > td { - height: 58px !important; -} - -.hcal-management-medium > tbody > tr > td, .hcal-management-medium > table > tbody > tr > td { - height: 80px !important; -} - -.hcal-management-medium tr[name='rest_b'], .hcal-management-medium tr[name='rest_c'], - .hcal-management-low tr[name='rest_a'], .hcal-management-low tr[name='rest_b'], .hcal-management-low tr[name='rest_c'] { - display: none; - visibility: hidden; -} - -.table-room_types { - flex: 1 1 auto; - margin-top: 1.2em; -} - -.table-room_type-data-header { - z-index: 1; -} - -.table-room_type-data-header .hcal-management-table tr td { - background-color: white; -} - -#hcal_management_widget { - overflow: auto; - display: flex; -} - -#hcal-management-container-dd { - overflow: auto; - flex: 1 1 auto; -} - -#btn_save_changes, #btn_massive_changes { - height: 56px; -} -#btn_save_changes i, #btn_massive_changes i { - top: 22%; -} - -.hcal-management-input-changed { - background-color: rgb(237,110,110); - border: 1px solid gray; -} - -.hcal-management-record-changed { - background-color: #FFFF66 !important; -} - -table.hcal-management-table input { - border: 1px solid lightgray; -} - -.hcal-border-radius-right { - border-top-right-radius: 25px; - border-bottom-right-radius: 25px; -} - -.hcal-border-radius-left { - border-top-left-radius: 25px; - border-bottom-left-radius: 25px; -} - -.hcal-management-record-options { - padding: 0.5em; -} - -.filter-title { - overflow: hidden; - text-overflow: ellipsis; -} - -button.hcal-management-input { - font-size: 9px; - border: 1px solid gray; - padding: 0.5em 2em 0.2em 2em; - border-radius: 3px; - margin: 0.2em; - - background: rgba(255,255,255,1); - background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%); - background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,1)), color-stop(47%, rgba(227,227,227,1)), color-stop(100%, rgba(194,194,194,1))); - background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%); - background: -o-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%); - background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%); - background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(227,227,227,1) 47%, rgba(194,194,194,1) 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#c2c2c2', GradientType=0 ); -} -button.hcal-management-input:hover { - background: rgba(255,255,255,1); - background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); - background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,1)), color-stop(47%, rgba(246,246,246,1)), color-stop(100%, rgba(237,237,237,1))); - background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); - background: -o-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); - background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); - background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed', GradientType=0 ); -} -button.hcal-management-input-active { - background: rgba(245,215,93,1) !important; - background: -moz-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important; - background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(245,215,93,1)), color-stop(47%, rgba(245,165,44,1)), color-stop(100%, rgba(255,153,0,1))) !important; - background: -webkit-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important; - background: -o-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important; - background: -ms-linear-gradient(top, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important; - background: linear-gradient(to bottom, rgba(245,215,93,1) 0%, rgba(245,165,44,1) 47%, rgba(255,153,0,1) 100%) !important; - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5d75d', endColorstr='#ff9900', GradientType=0 ) !important; -} diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js deleted file mode 100644 index c4efbc271..000000000 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar.js +++ /dev/null @@ -1,3126 +0,0 @@ -/* global _, moment */ -'use strict'; -/* - * Hotel Calendar JS - 2017-2018 - * GNU Public License - * Alexandre Díaz - * - * Dependencies: - * - moment - * - underscore - * - awesomeicons - * - bootstrap - * - jquery - */ - -function HotelCalendar(/*String*/querySelector, /*Dictionary*/options, /*List*/pricelist, /*restrictions*/restrictions, /*HTMLObject?*/_base) { - if (window === this) { - return new HotelCalendar(querySelector, options, pricelist, _base); - } - - this.$base = (_base === 'undefined') ? document : _base; - - if (typeof querySelector === 'string') { - this.e = this.$base.querySelector(querySelector); - if (!this.e) { - return false; - } - } else if (typeof querySelector === 'object') { - this.e = querySelector; - } else { - return { - Version: '0.5', - Author: "Alexandre Díaz", - Created: "20/04/2017", - Updated: "19/07/2018" - }; - } - - /** Strings **/ - this._strings = { - 'Save Changes': 'Save Changes' - }; - - /** Options **/ - var now_utc = moment(new Date()).utc(); - this.options = _.extend({ - startDate: now_utc, - days: now_utc.daysInMonth(), - rooms: [], - room_types: [], - room_classes: [], - allowInvalidActions: false, - assistedMovement: false, - endOfWeek: 6, - endOfWeekOffset: 0, - divideRoomsByCapacity: false, - currencySymbol: '€', - showPricelist: false, - showAvailability: false, - showNumRooms: 0, - paginatorStepsMin: 1, - paginatorStepsMax: 15, - showOverbookings: false, - showCancelled: false, - }, options); - - this.options.startDate = this.options.startDate.clone(); - this.options.startDate.subtract('1', 'd'); - this.options.orig_days = this.options.days; - this.options.days = this.parseDays(this.options.days) + 1; - this.options.rooms = _.map(this.options.rooms, function(item){ return item.clone(); }); - // Check correct values - if (this.options.rooms.length > 0 && !(this.options.rooms[0] instanceof HRoom)) { - this.options.rooms = []; - console.warn("[Hotel Calendar][init] Invalid Room definiton!"); - } - - /** Internal Values **/ - this._pricelist = pricelist || []; // Store Prices - this._pricelist_id = -1; // Store Price Plan ID (Because can be edited) - this._restrictions = restrictions || {}; // Store Restrictions - this._reservations = []; // Store Reservations - this._reservationsMap = {}; // Store Reservations Mapped by Room for Search Purposes - this._modeSwap = HotelCalendar.MODE.NONE; // Store Swap Mode - this._selectionMode = HotelCalendar.MODE.NONE; - this._endDate = this.options.startDate.clone().add(this.options.days, 'd'); // Store End Calendar Day - this._tableCreated = false; // Store Flag to Know Calendar Creation - this._cellSelection = {start:false, end:false, current:false}; // Store Info About Selected Cells - this._lazyModeReservationsSelection = false; // Store Info About Timer for Selection Action - this._domains = {}; // Store domains for filter rooms & reservations - this._divideDivs = false; - this._extraRowIndicators = ['EX-', '/#']; - - // Support - var self = this; - this._supportsPassive = false; - try { - var opts = Object.defineProperty({}, 'passive', { - get: function() { - self._supportsPassive = true; - } - }); - window.addEventListener("testPassive", null, opts); - window.removeEventListener("testPassive", null, opts); - } catch (e) {} - - // Calculate Capacities - this._roomCapacityTotal = 0; - this._roomCapacities = {}; - this._roomsMap = _.groupBy(this.options.rooms, 'type'); - var room_types = this.getRoomTypes(); - for (var rt of room_types) { - this._roomsMap[rt] = _.filter(this._roomsMap[rt], {overbooking: false, cancelled: false}); - this._roomCapacities[rt] = _.reduce(this._roomsMap[rt], function(memo, tr){ return memo + (tr.shared?tr.capacity:1); }, 0); - this._roomCapacityTotal += this._roomCapacities[rt]; - } - - /***/ - this._reset_action_reservation(); - if (!this._create()) { - return false; - } - - - /** Main Events **/ - document.addEventListener('mouseup', this.onMainMouseUp.bind(this), false); - document.addEventListener('touchend', this.onMainMouseUp.bind(this), false); - document.addEventListener('keyup', this.onMainKeyUp.bind(this), false); - document.addEventListener('keydown', this.onMainKeyDown.bind(this), false); - window.addEventListener('resize', _.debounce(this.onMainResize.bind(this), 300), false); - - return this; -} - -HotelCalendar.prototype = { - /** PUBLIC MEMBERS **/ - addEventListener: function(/*String*/event, /*Function*/callback) { - this.e.addEventListener(event, callback); - }, - - //==== CALENDAR - setStartDate: function(/*String,MomentObject*/date, /*Int*/days, /*Bool*/fullUpdate, /*Functions*/callback) { - if (moment.isMoment(date)) { - this.options.startDate = date; - } else if (typeof date === 'string'){ - this.options.startDate = HotelCalendar.toMoment(date); - } else { - console.warn("[Hotel Calendar][setStartDate] Invalid date format!"); - return; - } - - this.options.startDate.subtract('1','d'); - if (typeof days !== 'undefined') { - this.options.orig_days = days; - this.options.days = this.parseDays(days) + 1; - } - this._endDate = this.options.startDate.clone().add(this.options.days, 'd'); - - /*this.e.dispatchEvent(new CustomEvent( - 'hcOnChangeDate', - {'detail': {'prevDate':curDate, 'newDate': $this.options.startDate}}));*/ - this._updateView(!fullUpdate, callback); - }, - - getOptions: function(/*String?*/key) { - if (typeof key !== 'undefined') { - return this.options[key]; - } - return this.options; - }, - - parseDays: function(/*Int/String*/days) { - if (days === 'month') { - return moment().daysInMonth(); - } - return +days; - }, - - toggleOverbookingsVisibility: function(/*Bool*/show) { - this.options.showOverbookings = !this.options.showOverbookings; - }, - - toggleCancelledVisibility: function(/*Bool*/show) { - this.options.showCancelled = !this.options.showCancelled; - }, - - setSwapMode: function(/*Int*/mode) { - if (mode !== this._modeSwap) { - this._modeSwap = mode; - if (this._modeSwap === HotelCalendar.MODE.NONE) { - this._dispatchSwapReservations(); - this._reset_action_reservation(); - } else { - this.setSelectionMode(HotelCalendar.MODE.NONE); - } - - this._updateHighlightSwapReservations(); - } - }, - - setSelectionMode: function(/*Int*/mode) { - if (this._modeSwap === HotelCalendar.MODE.NONE) { - this._selectionMode = mode; - if (this._selectionMode === HotelCalendar.ACTION.DIVIDE) { - this.reservationAction.action = HotelCalendar.ACTION.DIVIDE; - for (var reserv of this._reservations) { - reserv._html.classList.add('hcal-reservation-to-divide'); - } - } else if (this._selectionMode === HotelCalendar.ACTION.UNIFY) { - this.reservationAction.action = HotelCalendar.ACTION.UNIFY; - this.reservationAction.toUnify = []; - } else { - for (var reserv of this._reservations) { - reserv._html.classList.remove('hcal-reservation-to-divide'); - } - if (this._divideDivs) { - this._divideDivs[0].remove(); - this._divideDivs[1].remove(); - this._divideDivs = false; - } - - - this._dispatchUnifyReservations(); - this._reset_action_reservation(); - this._updateHighlightUnifyReservations(); - } - - this._dispatchEvent('hcalOnChangeSelectionMode', { - 'newMode': this._selectionMode, - }); - } - }, - - getSelectionMode: function() { - return this._selectionMode; - }, - - getSwapMode: function() { - return this._modeSwap; - }, - - cancelSwap: function() { - if (this._modeSwap !== HotelCalendar.MODE.NONE) { - this._modeSwap = HotelCalendar.MODE.NONE; - this._dispatchEvent('hcalOnCancelSwapReservations'); - this._reset_action_reservation(); - this._updateHighlightSwapReservations(); - } - }, - - _updateOffsets: function() { - this._etableOffset = this.loopedOffsetOptimized(this.etable); - this._eOffset = this.loopedOffsetOptimized(this.e); - this._edivrOffset = this.loopedOffsetOptimized(this.edivr); - }, - - //==== DOMAINS - setDomain: function(/*Int*/section, /*Array*/domain) { - if (this._domains[section] !== domain) { - this._domains[section] = domain; - if (section === HotelCalendar.DOMAIN.RESERVATIONS) { - this._filterReservations(); - } else if (section === HotelCalendar.DOMAIN.ROOMS) { - this._filterRooms(); - } - } - }, - - getDomain: function(/*Int*/section) { - return this._domains[section] || []; - }, - - //==== RESERVATIONS - _filterReservations: function() { - for (var r of this._reservations) { - r._active = this._in_domain(r, this._domains[HotelCalendar.DOMAIN.RESERVATIONS]); - this._updateReservation(r, true); - } - - //_.defer(function(){ this._updateReservationOccupation() }.bind(this)); - }, - - getReservationAction: function() { - return this.reservationAction; - }, - - getReservation: function(/*Int,String*/id) { - return _.find(this._reservations, function(item){ return item.id == id; }); - }, - - // getReservationDiv: function(/*HReservationObject*/reservationObj) { - // var reservDiv = this.e.querySelector(`div.hcal-reservation[data-hcal-reservation-obj-id='${reservationObj.id}']`); - // return reservDiv; - // }, - - setReservations: function(/*List*/reservations) { - for (var reservation of this._reservations) { - this.removeReservation(reservation); - } - - this._reservations = []; - this.addReservations(reservations); - }, - - addReservations: function(/*List*/reservations) { - reservations = reservations || []; - - if (reservations.length > 0 && !(reservations[0] instanceof HReservation)) { - console.warn("[HotelCalendar][addReservations] Invalid Reservation definition!"); - } else { - var isCalendarEmpty = (this._reservations.length>0); - // Merge - var addedReservations = []; - for (var r of reservations) { - var rindex = _.findKey(this._reservations, {'id': r.id}); - if ((!this.options.showOverbookings && r.overbooking) || (!this.options.showCancelled && r.cancelled)) { - if (rindex) { - this.removeReservation(this._reservations[rindex]); - } - continue; - } - - var hasCreatedExtraRows = false; - r = r.clone(); // HOT-FIX: Multi-Calendar Support - r.room = this.getRoom(r.room_id, r.overbooking || r.cancelled, r.id); - // need create a overbooking row? - if (!r.room) { - if (r.overbooking || r.cancelled) { - r.room = this.createExtraRoom(this.getRoom(r.room_id), r.id, { - overbooking: r.overbooking, - cancelled: r.cancelled, - }); - this.createExtraRoomRow(r.room); - hasCreatedExtraRows = true; - } else { - console.warn(`Can't found the room '${r.room_id}' for the reservation '${r.id}' (${r.title})!`); - continue; - } - } - - if (rindex) { - var reserv = this._reservations[rindex]; - r._html = reserv._html; - if ((reserv.overbooking && !r.overbooking) || (reserv.cancelled && !r.cancelled)) { - if (this.getReservationsByRoom(reserv.room).length === 1) { - this.removeExtraRoomRow(reserv); - } - } - this._reservations[rindex] = r; - if (!r.unusedZone) { - this._cleanUnusedZones(r); - } - } else { - this._reservations.push(r); - } - - addedReservations.push(r); - } - - // Create & Render New Reservations - _.defer(function(reservs){ - // Update offsets (New Rooms change positions?) - this._updateOffsets(); - - var unusedZones = this._createUnusedZones(reservs); - // Add Unused Zones - this._reservations = this._reservations.concat(unusedZones); - // Create Map - this._updateReservationsMap(); - - var toAssignEvents = []; - reservs = reservs.concat(unusedZones); - for (var r of reservs) { - r._active = this._in_domain(r, this._domains[HotelCalendar.DOMAIN.RESERVATIONS]); - this._calcReservationCellLimits(r); - if (r._html) { - r._html.innerText = r.title; - } else if (r._limits.isValid()) { - r._html = document.createElement('div'); - r._html.dataset.hcalReservationObjId = r.id; - r._html.classList.add('hcal-reservation'); - r._html.classList.add('noselect'); - r._html.innerText = r.title; - this.edivr.appendChild(r._html); - - if (r.unusedZone) { - r._html.classList.add('hcal-unused-zone'); - } else { - toAssignEvents.push(r._html); - } - } - this._updateReservation(r); - } - - this._assignReservationsEvents(toAssignEvents); - }.bind(this), addedReservations); - - _.defer(function(){ this._updateReservationOccupation(); }.bind(this)); - } - }, - - removeReservation: function(/*HReservationObject*/reserv) { - if (reserv) { - // Remove all related content... - var elms = [reserv._html, this.e.querySelector(`.hcal-warn-ob-indicator[data-hcal-reservation-obj-id='${reserv.id}']`)]; - for (var elm of elms) { - if (elm && elm.parentNode) { - elm.parentNode.removeChild(elm); - } - } - // Remove OB Row - if (reserv.overbooking || reserv.cancelled) { - if (this.getReservationsByRoom(reserv.room).length === 1) { - this.removeExtraRoomRow(reserv); - } - } - // Remove Unused Zones - if (!reserv.unusedZone) { - this._cleanUnusedZones(reserv); - } - - this._reservations = _.reject(this._reservations, {id: reserv.id}); - this._updateReservationsMap(); - } else { - console.warn(`[HotelCalendar][removeReservation] Can't remove '${reserv.id}' reservation!`); - } - }, - - getReservationsByDay: function(/*MomentObject*/day, /*Bool?*/noCheckouts, /*Bool?*/includeUnusedZones, /*Int?*/nroom, /*Int?*/nbed, /*HReservation?*/ignoreThis) { - var inclusivity = noCheckouts?'[)':'[]'; - - if (typeof nroom !== 'undefined') { - return _.filter(this._reservationsMap[nroom], function(item){ - return day.isBetween(item.startDate, item.endDate, 'day', inclusivity) && - (typeof nbed === 'undefined' || item._beds.includes(nbed)) && - ((includeUnusedZones && item.unusedZone) || !item.unusedZone) && - item !== ignoreThis && !item.overbooking && !item.cancelled; - }); - } else { - return _.filter(this._reservations, function(item){ - return day.isBetween(item.startDate, item.endDate, 'day', inclusivity) && - (typeof nbed === 'undefined' || item._beds.includes(nbed)) && - ((includeUnusedZones && item.unusedZone) || !item.unusedZone) && - item !== ignoreThis && !item.overbooking && !item.cancelled; - }); - } - }, - - getReservationsByRoom: function(/*Int,HRoomObject*/room, /*Boolean*/includeUnusedZones) { - if (!(room instanceof HRoom)) { room = this.getRoom(room); } - if (room) { - return _.filter(this._reservationsMap[room.id], function(item){ - return (includeUnusedZones || (!includeUnusedZones && !item.unusedZone)); - }); - } - - return []; - }, - - _updateReservationsMap: function() { - this._reservationsMap = {}; - this._reservations.map(function(current){ - if (!(current.room.id in this._reservationsMap)) { - this._reservationsMap[current.room.id] = []; - } - this._reservationsMap[current.room.id].push(current); - }.bind(this)); - }, - - _calcReservationCellLimits: function(/*HReservationObject*/reservation, /*Int?*/nbed, /*Bool?*/notCheck) { - var limits = new HLimit(); - if (!reservation.startDate || !reservation.endDate || - (!reservation.startDate.isBetween(this.options.startDate, this._endDate, 'day', '[]') && - !reservation.endDate.isBetween(this.options.startDate, this._endDate, 'day', '[]') && - !reservation.startDate.isBefore(this.options.startDate, 'day', '()') && - !reservation.endDate.isAfter(this._endDate, 'day', '()'))) { - return limits; - } - - var notFound; - do { - notFound = false; - - // Num of beds - var bedNum; - if (typeof nbed === 'undefined') { - if (reservation._beds && reservation._beds.length) { - bedNum = reservation._beds[0]; - } else { - bedNum = (reservation.unusedZone)?1:0; - } - } else { - bedNum = nbed; - } - - // Search Initial Cell - if (reservation.startDate.clone().local().isSameOrAfter(this.options.startDate, 'd')) { - reservation._drawModes[0] = 'hard-start'; - limits.left = this.getCell(reservation.startDate.clone().local(), - reservation.room, - bedNum); - } - else { - reservation._drawModes[0] = 'soft-start'; - limits.left = this.getCell(this.options.startDate.clone().local(), - reservation.room, - bedNum); - } - - // More Beds? - var rpersons = (reservation.room.shared || this.options.divideRoomsByCapacity)?reservation.room.capacity:1; - var reservPersons = reservation.getTotalPersons(false); - if ((reservation.room.shared || this.options.divideRoomsByCapacity) && reservPersons > 1 && bedNum+reservPersons <= rpersons) { - bedNum += reservPersons-1; - } - - // Search End Cell - if (reservation.endDate.clone().subtract(1, 'd').local().isSameOrBefore(this._endDate, 'd')) { - reservation._drawModes[1] = 'hard-end'; - limits.right = this.getCell(reservation.endDate.clone().subtract(1, 'd').local(), - reservation.room, - bedNum); - } - else { - reservation._drawModes[1] = 'soft-end'; - limits.right = this.getCell(this._endDate.clone().local(), - reservation.room, - bedNum); - } - - // Exists other reservation in the same place? - if (!notCheck && limits.isValid()) { - var diff_date = this.getDateDiffDays(reservation.startDate, reservation.endDate); - var numBeds = +limits.right.dataset.hcalBedNum - +limits.left.dataset.hcalBedNum; - var ndate = reservation.startDate.clone().local(); - for (var i=0; i= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - - // Update Reservations Position - var bounds = this.loopedOffsetOptimized(row); - var cheight = bounds.height; - var start_index = _.indexOf(this.options.rooms, ex_room) + 1; - for (var i=start_index; i 0) - humantext += `Min. Stay: ${restr[0]}\n`; - if (restr[1] > 0) - humantext += `Min. Stay Arrival: ${restr[1]}\n`; - if (restr[2] > 0) - humantext += `Max. Stay: ${restr[2]}\n`; - if (restr[3] > 0) - humantext += `Max. Stay Arrival: ${restr[3]}\n`; - if (restr[4]) - humantext += `Closed: ${restr[4]}\n`; - if (restr[5]) - humantext += `Closed Arrival: ${restr[5]}\n`; - if (restr[6]) - humantext += `Closed Departure: ${restr[6]}`; - cell.title = humantext; - } - else { - cell.classList.remove('hcal-restriction-room-day'); - cell.title = ''; - } - } - } - } - } - } - } - }, - - //==== DETAIL CALCS - calcDayRoomTypeReservations: function(/*String,MomentObject*/day, /*String*/room_type) { - var day = HotelCalendar.toMoment(day); - if (!day) { return false; } - - var num_rooms = this._roomCapacities[room_type]; - num_rooms -= _.reduce(this.getDayRoomTypeReservations(day, room_type), function(memo, r){ return memo + ((r.room && r.room.shared)?r.getTotalPersons(false):1); }, 0); - return num_rooms; - }, - - calcDayRoomTotalReservations: function(/*String,MomentObject*/day) { - var day = HotelCalendar.toMoment(day); - if (!day) { return false; } - - var num_rooms = this._roomCapacityTotal; - num_rooms -= _.reduce(this.getReservationsByDay(day, true), function(memo, r){ return memo + ((r.room && r.room.shared)?r.getTotalPersons(false):1); }, 0); - return num_rooms; - }, - - - /** PRIVATE MEMBERS **/ - //==== MAIN FUNCTIONS - _reset_action_reservation: function() { - if (this._lazyModeReservationsSelection) { - clearTimeout(this._lazyModeReservationsSelection); - this._lazyModeReservationsSelection = false; - } - - this.reservationAction = { - action: HotelCalendar.ACTION.NONE, - reservation: null, - oldReservationObj: null, - newReservationObj: null, - mousePos: false, - inReservations: [], - outReservations: [], - }; - }, - - get_normalized_rooms_: function() { - var rooms = {}; - if (this.options.rooms) { - var keys = Object.keys(this.options.rooms); - - for (var r of this.options.rooms) { - rooms[r.number] = [r.type, r.capacity]; - } - } - return rooms; - }, - - //==== RENDER FUNCTIONS - _create: function() { - var $this = this; - while (this.e.hasChildNodes()) { - this.e.removeChild(this.e.lastChild); - } - - if (this._tableCreated) { - console.warn("[Hotel Calendar][_create] Already created!"); - return false; - } - - var scrollThrottle = _.throttle(this._updateOBIndicators.bind(this), 100); - - - this.edivcontainer = document.createElement("div"); - this.edivcontainer.classList.add('hcalendar-container'); - - // Reservations Table - this.edivrh = document.createElement("div"); - this.edivrh.classList.add('table-reservations-header'); - this.edivcontainer.appendChild(this.edivrh); - this.etableHeader = document.createElement("table"); - this.etableHeader.classList.add('hcal-table'); - this.etableHeader.classList.add('noselect'); - this.edivrh.appendChild(this.etableHeader); - this.edivr = document.createElement("div"); - this.edivr.classList.add('table-reservations'); - this.edivcontainer.appendChild(this.edivr); - this.etable = document.createElement("table"); - this.etable.classList.add('hcal-table'); - this.etable.classList.add('noselect'); - this.edivr.appendChild(this.etable); - this.edivr.addEventListener("scroll", scrollThrottle, false); - // Detail Calcs Table - this.edivch = document.createElement("div"); - this.edivch.classList.add('table-calcs-header'); - this.edivcontainer.appendChild(this.edivch); - this.edtableHeader = document.createElement("table"); - this.edtableHeader.classList.add('hcal-table'); - this.edtableHeader.classList.add('noselect'); - this.edivch.appendChild(this.edtableHeader); - this.edivc = document.createElement("div"); - this.edivc.classList.add('table-calcs'); - this.edivcontainer.appendChild(this.edivc); - this.edtable = document.createElement("table"); - this.edtable.classList.add('hcal-table'); - this.edtable.classList.add('noselect'); - this.edivc.appendChild(this.edtable); - - var observer = new MutationObserver(function(mutationsList){ - $this._updateOBIndicators(); - }); - observer.observe(this.edivr, { childList: true }); - - this.e.appendChild(this.edivcontainer); - - this._updateView(); - //_.defer(function(self){ self._updateView(); }, this); - this._tableCreated = true; - - return true; - }, - - _generateTableDay: function(/*HTMLObject*/parentCell, /*HRoomObject*/room) { - var $this = this; - var table = document.createElement("table"); - table.classList.add('hcal-table-day'); - table.classList.add('noselect'); - var row = false; - var cell = false; - var num = ((room.shared || this.options.divideRoomsByCapacity)?room.capacity:1); - for (var i=0; i${dd_local.format('D')}`; - cell.setAttribute('title', dd_local.format('dddd')) - var day = +dd_local.format('D'); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - cur_month = dd_local.format('MMMM'); - months[cur_month] = {}; - months[cur_month].year = dd_local.format('YYYY'); - months[cur_month].colspan = 0; - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - ++months[cur_month].colspan; - } - // Render Months - var month_keys = Object.keys(months); - for (var m of month_keys) { - var cell_month = row_init.insertCell(); - cell_month.setAttribute('colspan', months[m].colspan); - cell_month.innerText = m+' '+months[m].year; - cell_month.classList.add('hcal-cell-month'); - cell_month.classList.add('btn-hcal'); - cell_month.classList.add('btn-hcal-3d'); - } - - /** ROOM LINES **/ - var tbody = document.createElement("tbody"); - this.etable.appendChild(tbody); - for (var itemRoom of this.options.rooms) { - // Room Number - row = tbody.insertRow(); - row.dataset.hcalRoomObjId = itemRoom.id; - row.classList.add('hcal-row-room-type-group-item'); - if ((this.options.showOverbookings && itemRoom.overbooking) || (this.options.showCancelled && itemRoom.cancelled)) { - var reservId = this.parseExtraRoomId(itemRoom.id)[0]; - var cnumber = this.getExtraRoomRealNumber(itemRoom); - row.setAttribute('id', this._sanitizeId(`ROW_${cnumber}_${itemRoom.type}_EXTRA${reservId}`)); - row.classList.add('hcal-row-room-type-group-overbooking-item'); - } else { - row.setAttribute('id', $this._sanitizeId(`ROW_${itemRoom.number}_${itemRoom.type}`)); - } - cell = row.insertCell(); - cell.textContent = itemRoom.number; - cell.classList.add('hcal-cell-room-type-group-item'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-left'); - cell.setAttribute('colspan', '3'); - /* - cell = row.insertCell(); - cell.textContent = itemRoom.type; - cell.classList.add('hcal-cell-room-type-group-item'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-flat'); - */ - for (var i=0; i<=$this.options.days; i++) { - var dd = $this.options.startDate.clone().local().startOf('day').add(i,'d').utc(); - var dd_local = dd.clone().local(); - cell = row.insertCell(); - cell.setAttribute('id', $this._sanitizeId(`${itemRoom.type}_${itemRoom.number}_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); - cell.classList.add('hcal-cell-room-type-group-item-day'); - cell.dataset.hcalParentRow = row.getAttribute('id'); - cell.dataset.hcalDate = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); - cell.dataset.hcalRoomObjId = itemRoom.id; - // Generate Interactive Table - cell.appendChild($this._generateTableDay(cell, itemRoom)); - //cell.innerHTML = dd.format("DD"); - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - - itemRoom._html = row; - } - - this._filterRooms(); - this._calcViewHeight(); - }, - - _calcViewHeight: function() { - if (this.options.showNumRooms > 0) { - var rows = this.edivr.querySelectorAll('tr.hcal-row-room-type-group-item'); - var cheight = 0.0; - for (var i=0; i${dd_local.format('D')}`; - cell.setAttribute('title', dd_local.format("dddd")) - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - - /** DETAIL LINES **/ - var tbody = document.createElement("tbody"); - this.edtable.appendChild(tbody); - if (this.options.showAvailability) { - // Rooms Free Types - if (this.options.rooms) { - var room_types = this.getRoomTypes(); - for (var rt of room_types) { - if (rt || room_types.length > 1) { - row = tbody.insertRow(); - row.setAttribute('id', this._sanitizeId(`ROW_DETAIL_FREE_TYPE_${rt}`)); - row.dataset.hcalRoomType = rt; - row.classList.add('hcal-row-detail-room-free-type-group-item'); - cell = row.insertCell(); - cell.textContent = rt; - cell.classList.add('hcal-cell-detail-room-free-type-group-item'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-left'); - cell.setAttribute("colspan", "3"); - for (var i=0; i<=this.options.days; i++) { - var dd = this.options.startDate.clone().local().startOf('day').add(i,'d').utc(); - var dd_local = dd.clone().local(); - cell = row.insertCell(); - cell.setAttribute('id', this._sanitizeId(`CELL_FREE_${rt}_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); - cell.classList.add('hcal-cell-detail-room-free-type-group-item-day'); - cell.dataset.hcalParentRow = row.getAttribute('id'); - cell.dataset.hcalDate = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); - cell.textContent = '0'; - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - } - } - } - // Total Free - row = tbody.insertRow(); - row.setAttribute('id', "ROW_DETAIL_TOTAL_FREE"); - row.classList.add('hcal-row-detail-room-free-total-group-item'); - cell = row.insertCell(); - cell.textContent = 'FREE TOTAL'; - cell.classList.add('hcal-cell-detail-room-free-total-group-item'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-left'); - cell.setAttribute("colspan", "3"); - for (var i=0; i<=this.options.days; i++) { - var dd = this.options.startDate.clone().local().startOf('day').add(i,'d').utc(); - var dd_local = dd.clone().local(); - cell = row.insertCell(); - cell.setAttribute('id', this._sanitizeId(`CELL_DETAIL_TOTAL_FREE_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); - cell.classList.add('hcal-cell-detail-room-free-total-group-item-day'); - cell.dataset.hcalParentRow = row.getAttribute('id'); - cell.dataset.hcalDate = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); - cell.textContent = '0'; - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - // Percentage Occupied - row = tbody.insertRow(); - row.setAttribute('id', "ROW_DETAIL_PERC_OCCUP"); - row.classList.add('hcal-row-detail-room-perc-occup-group-item'); - cell = row.insertCell(); - cell.textContent = '% OCCUP.'; - cell.classList.add('hcal-cell-detail-room-perc-occup-group-item'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-left'); - cell.setAttribute("colspan", "3"); - for (var i=0; i<=this.options.days; i++) { - var dd = this.options.startDate.clone().local().startOf('day').add(i,'d').utc(); - var dd_local = dd.clone().local(); - cell = row.insertCell(); - cell.setAttribute('id', this._sanitizeId(`CELL_DETAIL_PERC_OCCUP_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); - cell.classList.add('hcal-cell-detail-room-perc-occup-group-item-day'); - cell.dataset.hcalParentRow = row.getAttribute('id'); - cell.dataset.hcalDate = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); - cell.textContent = '0'; - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - } - // Rooms Pricelist - this._pricelist_id = _.keys(this._pricelist)[0]; - if (this.options.showPricelist && this._pricelist) { - //var pricelists_keys = _.keys(this._pricelist) - //for (var key of pricelists_keys) { - var key = this._pricelist_id; - var pricelist = this._pricelist[key]; - for (var listitem of pricelist) { - row = tbody.insertRow(); - row.setAttribute('id', this._sanitizeId(`ROW_DETAIL_PRICE_ROOM_${key}_${listitem.room}`)); - row.dataset.hcalPricelist = key; - row.dataset.hcalRoomTypeId = listitem.room - row.classList.add('hcal-row-detail-room-price-group-item'); - cell = row.insertCell(); - var span = document.createElement('span'); - cell.title = cell.textContent = listitem.title + ' ' + this.options.currencySymbol; - cell.classList.add('hcal-cell-detail-room-group-item', 'btn-hcal', 'btn-hcal-left'); - cell.dataset.currencySymbol = this.options.currencySymbol; - cell.setAttribute("colspan", "3"); - for (var i=0; i<=$this.options.days; i++) { - var dd = this.options.startDate.clone().local().startOf('day').add(i,'d').utc(); - var dd_local = dd.clone().local(); - cell = row.insertCell(); - cell.setAttribute('id', this._sanitizeId(`CELL_PRICE_${key}_${listitem.room}_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); - cell.classList.add('hcal-cell-detail-room-price-group-item-day'); - cell.dataset.hcalParentRow = row.getAttribute('id'); - cell.dataset.hcalDate = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - - var input = document.createElement('input'); - input.setAttribute('id', this._sanitizeId(`INPUT_PRICE_${key}_${listitem.room}_${dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_)}`)); - input.setAttribute('type', 'edit'); - input.setAttribute('title', 'Price'); - input.setAttribute('name', 'room_type_price_day'); - input.dataset.hcalParentCell = cell.getAttribute('id'); - var dd_fmrt = dd_local.format(HotelCalendar.DATE_FORMAT_SHORT_); - input.dataset.orgValue = input.value = _.has(listitem['days'], dd_fmrt)?Number(listitem['days'][dd_fmrt]).toLocaleString():'...'; - input.addEventListener('change', function(ev){ $this._onInputChange(ev, this); }, false); - cell.appendChild(input); - } - } - //} - } - }, - - //==== UPDATE FUNCTIONS - _updateView: function(/*Bool*/notData, /*function*/callback) { - this._createTableReservationDays(); - if (typeof callback !== 'undefined') { - callback(); - } - this._updateCellSelection(); - this._createTableDetailDays(); - - _.defer(function(self){ - self._updateOffsets(); - self._updateReservations(true); - if (!notData) { - _.defer(function(self){ - self._updateRestrictions(); - self._updatePriceList(); - self._updateReservationOccupation(); - }, self); - } - }, this); - // if (!notData) { - // _.defer(function(self){ - // self._createTableDetailDays(); - // self._updateRestrictions(); - // self._updatePriceList(); - // self._updateReservationOccupation(); - // }, this); - // } - }, - - _updateOBIndicators: function() { - var mainBounds = this._edivrOffset; - for (var reserv of this._reservations) { - if (reserv.overbooking && reserv._html) { - var eOffset = this._eOffset; - var bounds = this.loopedOffsetOptimized(reserv._html); - if (bounds.top > mainBounds.height) { - var warnDiv = this.e.querySelector(`div.hcal-warn-ob-indicator[data-hcal-reservation-obj-id='${reserv.id}']`); - if (!warnDiv) { - var warnDiv = document.createElement("DIV"); - warnDiv.innerHTML = ""; - warnDiv.classList.add('hcal-warn-ob-indicator'); - warnDiv.style.borderTopLeftRadius = warnDiv.style.borderTopRightRadius = "50px"; - warnDiv.dataset.hcalReservationObjId = reserv.id; - this.edivcontainer.appendChild(warnDiv); - var warnComputedStyle = window.getComputedStyle(warnDiv, null); - warnDiv.style.top = `${mainBounds.height - eOffset.top - parseInt(warnComputedStyle.getPropertyValue("height"), 10)}px`; - warnDiv.style.left = `${(bounds.left + (bounds.right - bounds.left)/2.0 - parseInt(warnComputedStyle.getPropertyValue("width"), 10)/2.0) - mainBounds.left}px`; - } - } else if (bounds.height < mainBounds.top) { - var warnDiv = this.e.querySelector(`div.hcal-warn-ob-indicator[data-hcal-reservation-obj-id='${reserv.id}']`); - if (!warnDiv) { - var warnDiv = document.createElement("DIV"); - warnDiv.innerHTML = ""; - warnDiv.classList.add('hcal-warn-ob-indicator'); - warnDiv.style.borderBottomLeftRadius = warnDiv.style.borderBottomRightRadius = "50px"; - warnDiv.style.top = `${mainBounds.top - eOffset.top}px`; - warnDiv.dataset.hcalReservationObjId = reserv.id; - this.edivcontainer.appendChild(warnDiv); - var warnComputedStyle = window.getComputedStyle(warnDiv, null); - warnDiv.style.left = `${(bounds.left + (bounds.right - bounds.left)/2.0 - parseInt(warnComputedStyle.getPropertyValue("width"), 10)/2.0) - mainBounds.left}px`; - } - } else { - var warnDiv = this.e.querySelector(`div.hcal-warn-ob-indicator[data-hcal-reservation-obj-id='${reserv.id}']`); - if (warnDiv) { - warnDiv.parentNode.removeChild(warnDiv); - } - } - } - } - }, - - _updateHighlightUnifyReservations: function() { - var $this = this; - if (!this.reservationAction.toUnify || this.reservationAction.toUnify.length === 0) { - var elms = this.e.querySelectorAll("div.hcal-reservation-invalid-unify"); - for (var elm of elms) { elm.classList.remove('hcal-reservation-invalid-unify'); } - elms = this.e.querySelectorAll("div.hcal-reservation-unify-selected"); - for (var elm of elms) { elm.classList.remove('hcal-reservation-unify-selected'); } - } - else { - var dateLimits = this.getDateLimits(this.reservationAction.toUnify, false); - var refUnifyReservation = this.reservationAction.toUnify[0]; - var uniRoom = refUnifyReservation?refUnifyReservation.room.id:false; - for (var nreserv of this._reservations) { - if (nreserv.unusedZone || nreserv._html.classList.contains('hcal-reservation-unify-selected')) { - continue; - } - - // Invalid? - if (nreserv.room.id !== uniRoom || (!nreserv.startDate.isSame(dateLimits[1], 'day') && !nreserv.endDate.isSame(dateLimits[0], 'day')) || - (nreserv.id !== refUnifyReservation.id && nreserv.getUserData('parent_reservation') !== refUnifyReservation.id)) - { - nreserv._html.classList.add('hcal-reservation-invalid-unify'); - } - else { - nreserv._html.classList.remove('hcal-reservation-invalid-unify'); - } - } - } - }, - - _updateHighlightSwapReservations: function() { - var $this = this; - if (this.reservationAction.inReservations.length === 0 && this.reservationAction.outReservations.length === 0) { - var elms = this.e.querySelectorAll("div.hcal-reservation-invalid-swap"); - for (var elm of elms) { elm.classList.remove('hcal-reservation-invalid-swap'); } - elms = this.e.querySelectorAll("div.hcal-reservation-swap-in-selected"); - for (var elm of elms) { elm.classList.remove('hcal-reservation-swap-in-selected'); } - elms = this.e.querySelectorAll("div.hcal-reservation-swap-out-selected"); - for (var elm of elms) { elm.classList.remove('hcal-reservation-swap-out-selected'); } - } - else { - var dateLimits = this.getDateLimits(this.reservationAction.inReservations, true); - var refInReservation = this.reservationAction.inReservations[0]; - var refOutReservation = this.reservationAction.outReservations[0]; - var inCapacity = refInReservation?refInReservation.room.capacity:false; - var outCapacity = refOutReservation?refOutReservation.room.capacity:false; - var realDateLimits = this.getFreeDatesByRoom(dateLimits[0], dateLimits[1], refInReservation?refInReservation.room.id:refOutReservation.room.id); - for (var nreserv of this._reservations) { - if (nreserv.unusedZone || nreserv._html.classList.contains('hcal-reservation-swap-in-selected') || nreserv._html.classList.contains('hcal-reservation-swap-out-selected')) { - continue; - } - - // Invalid capacity - var totalReservPerson = nreserv.getTotalPersons(false); - if (totalReservPerson > inCapacity || (outCapacity && totalReservPerson > outCapacity) || nreserv.room.capacity < refInReservation.getTotalPersons(false)) - { - nreserv._html.classList.add('hcal-reservation-invalid-swap'); - } - else if (this._modeSwap === HotelCalendar.MODE.SWAP_FROM && this.reservationAction.inReservations.length !== 0 && refInReservation.room.id !== nreserv.room.id) { - if (!_.find(this.reservationAction.outReservations, {'id': nreserv.linkedId})) { - nreserv._html.classList.add('hcal-reservation-invalid-swap'); - } - } else if (this._modeSwap === HotelCalendar.MODE.SWAP_TO && this.reservationAction.outReservations.length !== 0 && refOutReservation.room.id !== nreserv.room.id) { - if (!_.find(this.reservationAction.inReservations, {'id': nreserv.linkedId})) { - nreserv._html.classList.add('hcal-reservation-invalid-swap'); - } - } - // Invalid reservations out of dates - else if (nreserv.startDate.isBefore(realDateLimits[0], 'day') || nreserv.endDate.clone().subtract('1', 'd').isAfter(realDateLimits[1], 'day')) { - if (nreserv.room.id !== refInReservation.room.id) { - nreserv._html.classList.add('hcal-reservation-invalid-swap'); - } - } - else { - nreserv._html.classList.remove('hcal-reservation-invalid-swap'); - } - } - } - }, - - _updateHighlightInvalidZones: function(/*HReservation*/reserv) { - if (typeof reserv === 'undefined') { - var elms = this.etable.querySelectorAll("td[data-hcal-date] table td"); - for (var tdCell of elms) { - tdCell.classList.remove('hcal-cell-invalid'); - } - return; - } - - if (reserv.readOnly) { - var elms = this.etable.querySelectorAll("td[data-hcal-date] table td"); - for (var tdCell of elms) { - tdCell.classList.add('hcal-cell-invalid'); - } - } else if (reserv.fixDays) { - var limitLeftDate = this.etable.querySelector(`#${reserv._limits.left.dataset.hcalParentCell}`).dataset.hcalDate; - var limitRightDate = this.etable.querySelector(`#${reserv._limits.right.dataset.hcalParentCell}`).dataset.hcalDate; - var limitLeftDateMoment = HotelCalendar.toMoment(limitLeftDate); - var limitRightDateMoment = HotelCalendar.toMoment(limitRightDate); - var diff_date = this.getDateDiffDays(limitLeftDateMoment, limitRightDateMoment); - var date = limitLeftDateMoment.clone().startOf('day'); - var selector = []; - for (var i=0; i<=diff_date; i++) { - selector.push("not([data-hcal-date='"+date.format(HotelCalendar.DATE_FORMAT_SHORT_)+"'])"); - date.add(1, 'd'); - } - if (selector.length) { - var elms = this.etable.querySelectorAll(`td:${selector.join(':')}`+ ' table td'); - for (var tdCell of elms) { - tdCell.classList.add('hcal-cell-invalid'); - } - } - } else if (reserv.fixRooms) { - var parentCell = this.etable.querySelector(`#${reserv._limits.left.dataset.hcalParentCell}`); - var parent_row = parentCell.dataset.hcalParentRow; - var elms = this.etable.querySelectorAll("td:not([data-hcal-parent-row='"+parent_row+"']) table td"); - for (var tdCell of elms) { - tdCell.classList.add('hcal-cell-invalid'); - } - } else { - var limitLeftDate = this.etable.querySelector(`#${reserv._limits.left.dataset.hcalParentCell}`).dataset.hcalDate; - var limitRightDate = this.etable.querySelector(`#${reserv._limits.right.dataset.hcalParentCell}`).dataset.hcalDate; - var limitLeftDateMoment = HotelCalendar.toMoment(limitLeftDate); - var limitRightDateMoment = HotelCalendar.toMoment(limitRightDate); - var diff_date = this.getDateDiffDays(limitLeftDateMoment, limitRightDateMoment)+1; - if (reserv._drawModes[1] === 'hard-end') { --diff_date; } - var date = limitLeftDateMoment.clone().startOf('day'); - var selector = []; - for (var i=0; i<=diff_date; i++) { - selector.push("td[data-hcal-date='"+date.format(HotelCalendar.DATE_FORMAT_SHORT_)+"'] table td"); - date.add(1, 'd'); - } - if (selector.length) { - var elms = this.etable.querySelectorAll(`${selector.join(', ')}`); - for (var tdCell of elms) { - tdCell.classList.add('hcal-cell-highlight'); - } - } - } - }, - - _updateScroll: function(/*HTMLObject*/reservationDiv) { - var reservBounds = this.loopedOffsetOptimized(reservationDiv); - var mainBounds = this._edivrOffset; - var eOffset = this._eOffset; - var bottom = mainBounds.height - eOffset.top; - var top = mainBounds.top + eOffset.top; - var offset = 10.0; - var scrollDisp = 10.0; - if (reservBounds.height >= bottom-offset) { - this.edivr.scrollBy(0, scrollDisp); - } - else if (reservBounds.top <= top+offset) { - this.edivr.scrollBy(0, -scrollDisp); - } - }, - - //==== SELECTION - _updateCellSelection: function() { - // Clear all - var highlighted_td = this.etable.querySelectorAll('td.hcal-cell-highlight'); - for (var td of highlighted_td) { - td.classList.remove('hcal-cell-highlight'); - td.textContent = ''; - } - - // Highlight Selected - if (this._cellSelection.current) { - this._cellSelection.current.classList.add('hcal-cell-highlight'); - } - // Highlight Range Cells - var cells = false; - var total_price = 0.0; - var limits = new HLimit(this._cellSelection.start, - this._cellSelection.end?this._cellSelection.end:this._cellSelection.current); - if (limits.isValid()) { - // Normalize - // TODO: Multi-Directional Selection. Now only support normal or inverse. - var limitLeftDate = HotelCalendar.toMoment(this.etable.querySelector(`#${limits.left.dataset.hcalParentCell}`).dataset.hcalDate); - var limitRightDate = HotelCalendar.toMoment(this.etable.querySelector(`#${limits.right.dataset.hcalParentCell}`).dataset.hcalDate); - if (limitLeftDate.isAfter(limitRightDate)) { - limits.swap(); - } - cells = this.getCells(limits); - for (var c of cells) { - var parentRow = this.$base.querySelector(`#${c.dataset.hcalParentRow}`); - var room = this.getRoom(parentRow.dataset.hcalRoomObjId); - if (room.overbooking || room.cancelled) { - continue; - } - c.classList.add('hcal-cell-highlight'); - if (this._pricelist) { - // FIXME: Normalize data calendar (gmt) vs extra info (utc) - var date_cell = HotelCalendar.toMoment(this.etable.querySelector(`#${c.dataset.hcalParentCell}`).dataset.hcalDate); - var room_price = this.getRoomPrice(parentRow.dataset.hcalRoomObjId, date_cell); - c.textContent = room_price + ' ' + this.options.currencySymbol; - if (!room.shared && c.dataset.hcalBedNum > limits.left.dataset.hcalBedNum) { - c.style.color = 'lightgray'; - } - else { - c.style.color = 'black'; - total_price += room_price; - } - } - } - } - - this._dispatchEvent( - 'hcalOnUpdateSelection', - { - 'limits': limits, - 'cells': cells, - 'old_cells': highlighted_td, - 'totalPrice': total_price - }); - }, - - _resetCellSelection: function() { - this._cellSelection = { current: false, end: false, start: false }; - }, - - //==== RESERVATIONS - _updateDivReservation: function(/*HReservationObject*/reserv, /*Bool?*/noRefresh) { - if (!reserv._limits.isValid() || !reserv._html) { - return; - } - - if (reserv.readOnly) { - reserv._html.classList.add('hcal-reservation-readonly'); - } else { - reserv._html.classList.remove('hcal-reservation-readonly'); - } - - if (reserv.room._active) { - reserv._html.classList.remove('hcal-hidden'); - } else { - reserv._html.classList.add('hcal-hidden'); - } - - if (reserv._active) { - reserv._html.classList.remove('hcal-reservation-unselect'); - } else { - reserv._html.classList.add('hcal-reservation-unselect'); - } - - if (!noRefresh) { - var boundsInit = this.loopedOffsetOptimized(reserv._limits.left); - var boundsEnd = this.loopedOffsetOptimized(reserv._limits.right); - var divHeight = (boundsEnd.top+boundsEnd.height)-boundsInit.top-4; - var has_changed = false; - - var reservStyles = { - backgroundColor: reserv.color, - color: reserv.colorText, - lineHeight: `${divHeight}px`, - fontSize: '12px', - top: `${boundsInit.top-this._etableOffset.top+2}px`, - left: `${boundsInit.left-this._etableOffset.left+2}px`, - width: `${(boundsEnd.left-boundsInit.left)+boundsEnd.width-4}px`, - height: `${divHeight}px`, - borderLeftWidth: '', - borderLeftStyle: '', - borderRightWidth: '', - borderRightStyle: '', - }; - - if (reserv._drawModes[0] === 'soft-start') { - has_changed = true; - reservStyles.borderLeftWidth = '3px'; - reservStyles.borderLeftStyle = 'double'; - reservStyles.left = `${boundsInit.left-this._etableOffset.left}px`; - reservStyles.width = `${(boundsEnd.left-boundsInit.left)+boundsEnd.width-2}px`; - } else if (reserv.splitted && reserv.startDate.isSame(reserv.getUserData('realDates')[0], 'day')) { - has_changed = true; - reservStyles.borderLeftWidth = '0'; - reservStyles.width = `${(boundsEnd.left-boundsInit.left)+boundsEnd.width-2}px`; - } - - if (reserv._drawModes[1] === 'soft-end') { - has_changed = true; - reservStyles.borderRightWidth = '3px'; - reservStyles.borderRightStyle = 'double'; - reservStyles.width = `${(boundsEnd.left-boundsInit.left)+boundsEnd.width-2}px`; - } else if (reserv.splitted && reserv.endDate.isSame(reserv.getUserData('realDates')[1], 'day')) { - has_changed = true; - reservStyles.borderRightWidth = '0'; - reservStyles.left = `${boundsInit.left-this._etableOffset.left-1}px`; - reservStyles.width = `${(boundsEnd.left-boundsInit.left)+boundsEnd.width-1}px`; - } - - if (reserv.splitted) { - reserv._html.classList.add('hcal-reservation-splitted'); - // 1. Use reservation ID as seed - // 2. Use sinusiudal function - // 3. Only use positive values (This decrease longitude) - // 4. Use the first 5 decimals to make the integer value - // 5. Get integer value (Bitwise tilde method) - // TODO: Improve pseudo-random number generator - var magicNumber = ~~(Math.abs(Math.sin((reserv.getUserData('parent_reservation') || reserv.id))) * 100000); - var bbColor = this._intToRgb(magicNumber); - reservStyles.borderColor = `rgb(${bbColor[0]},${bbColor[1]},${bbColor[2]})`; - - if (!has_changed) { - reservStyles.left = `${boundsInit.left-this._etableOffset.left-1}px`; - reservStyles.width = `${(boundsEnd.left-boundsInit.left)+boundsEnd.width+2}px`; - } - } else { - reserv._html.classList.remove('hcal-reservation-splitted'); - } - - Object.assign(reserv._html.style, reservStyles); - } - }, - - swapReservations: function(/*List HReservationObject*/fromReservations, /*List HReservationObject*/toReservations) { - if (fromReservations.length === 0 || toReservations.length === 0) { - console.warn("[HotelCalendar][swapReservations] Invalid Swap Operation!"); - return false; - } - var fromDateLimits = this.getDateLimits(fromReservations, true); - var fromRealDateLimits = this.getFreeDatesByRoom(fromDateLimits[0], fromDateLimits[1], fromReservations[0].room.id); - var toDateLimits = this.getDateLimits(toReservations, true); - var toRealDateLimits = this.getFreeDatesByRoom(toDateLimits[0], toDateLimits[1], toReservations[0].room.id); - - if (fromDateLimits[0].clone().local().isSameOrAfter(toRealDateLimits[0].clone().local(), 'd') && fromDateLimits[1].clone().local().isSameOrBefore(toRealDateLimits[1].clone().local(), 'd') && - toDateLimits[0].clone().local().isSameOrAfter(fromRealDateLimits[0].clone().local(), 'd') && toDateLimits[1].clone().local().isSameOrBefore(fromRealDateLimits[1].clone().local(), 'd')) - { - // Change some critical values - var refFromReservs = fromReservations[0]; - var refToReservs = toReservations[0]; - var refFromRoom = refFromReservs.room; - var refToRoom = refToReservs.room; - var fromRoomRow = this.getExtraRoomRow(refFromReservs); - var toRoomRow = this.getExtraRoomRow(refToReservs); - var refFromRoomNewId = (refFromRoom.overbooking||refFromRoom.cancelled)?this.parseExtraRoomId(refFromRoom.id)[1]:refFromRoom.id; - refFromRoomNewId = `${refToReservs.id}@${refFromRoomNewId}`; - var refToRoomNewId = (refToRoom.overbooking||refToRoom.cancelled)?this.parseExtraRoomId(refToRoom.id)[1]:refToRoom.id; - refToRoomNewId = `${refFromReservs.id}@${refToRoomNewId}`; - - if (refFromRoom.overbooking || refFromRoom.cancelled) { - var cnumber = this.getExtraRoomRealNumber(refFromRoom); - refFromRoom.id = refFromRoomNewId; - var newRowId = `${this._sanitizeId(`ROW_${cnumber}_${refToRoom.type}_EXTRA${refToReservs.id}`)}`; - var elms = fromRoomRow.querySelectorAll(`td[data-hcal-parent-row='${fromRoomRow.id}']`); - for (var elm of elms) { elm.dataset.hcalParentRow = newRowId; } - fromRoomRow.setAttribute('id', `${newRowId}`); - fromRoomRow.dataset.hcalRoomObjId = refFromRoom.id; - } - if (refToRoom.overbooking || refToRoom.cancelled) { - var cnumber = this.getExtraRoomRealNumber(refToRoom); - refToRoom.id = refToRoomNewId; - var newRowId = `${this._sanitizeId(`ROW_${cnumber}_${refFromRoom.type}_EXTRA${refFromReservs.id}`)}`; - var elms = toRoomRow.querySelectorAll(`td[data-hcal-parent-row='${toRoomRow.id}']`); - for (var elm of elms) { elm.dataset.hcalParentRow = newRowId; } - toRoomRow.setAttribute('id', `${newRowId}`); - toRoomRow.dataset.hcalRoomObjId = refToRoom.id; - } - - for (var nreserv of fromReservations) { - nreserv.cancelled = refToRoom.cancelled; - nreserv.overbooking = refToRoom.overbooking; - nreserv.room = refToRoom; - } - for (var nreserv of toReservations) { - nreserv.cancelled = refFromRoom.cancelled; - nreserv.overbooking = refFromRoom.overbooking; - nreserv.room = refFromRoom; - } - } else { - console.warn("[HotelCalendar][swapReservations] Invalid Swap Operation!"); - return false; - } - - return true; - }, - - _dispatchSwapReservations: function() { - if (this.reservationAction.inReservations.length > 0 && this.reservationAction.outReservations.length > 0) { - this._dispatchEvent( - 'hcalOnSwapReservations', - { - 'inReservs': this.reservationAction.inReservations || [], - 'outReservs': this.reservationAction.outReservations || [], - } - ); - } - }, - - _dispatchUnifyReservations: function() { - if (this.reservationAction.hasOwnProperty('toUnify') && this.reservationAction.toUnify.length > 1) { - this._dispatchEvent( - 'hcalOnUnifyReservations', - { - 'toUnify': this.reservationAction.toUnify || [], - } - ); - } - }, - - replaceReservation: function(/*HReservationObject*/reservationObj, /*HReservationObject*/newReservationObj) { - if (!reservationObj._html) { - console.warn("[Hotel Calendar][updateReservation_] Invalid Reservation Object"); - return; - } - - var index = _.findKey(this._reservations, {'id': reservationObj.id}); - delete this._reservations[index]; - this._reservations[index] = newReservationObj; - reservationObj._html.dataset.hcalReservationObjId = newReservationObj.id; - this._updateReservationsMap(); - this._updateDivReservation(newReservationObj); - - var linkedReservations = this.getLinkedReservations(newReservationObj); - for (var lr of linkedReservations) { - lr.startDate = newReservationObj.startDate.clone(); - lr.endDate = newReservationObj.endDate.clone(); - - if (lr._html) { - this._calcReservationCellLimits(lr); - this._updateDivReservation(lr); - } - } - _.defer(function(){ this._updateReservationOccupation(); }.bind(this)); - }, - - getLinkedReservations: function(/*HReservationObject*/reservationObj) { - return _.reject(this._reservations, function(item){ return item.linkedId !== reservationObj.id; }); - }, - - _updateReservation: function(/*HReservationObject*/reservationObj, /*Bool?*/noRefresh) { - // Fill - if (reservationObj._limits.isValid()) { - this._updateDivReservation(reservationObj, noRefresh); - } else { - console.warn(`[Hotel Calendar][_updateReservation] Can't place reservation ID@${reservationObj.id} [${reservationObj.startDate.format(HotelCalendar.DATE_FORMAT_LONG_)} --> ${reservationObj.endDate.format(HotelCalendar.DATE_FORMAT_LONG_)}]`); - this.removeReservation(reservationObj); - } - }, - - _updateReservations: function(/*Bool*/updateLimits) { - for (var reservation of this._reservations){ - if (updateLimits) { - this._calcReservationCellLimits(reservation); - } - this._updateReservation(reservation); - } - //this._assignReservationsEvents(); - //this._updateReservationOccupation(); - this._updateOBIndicators(); - }, - - _assignReservationsEvents: function(reservDivs) { - var $this = this; - reservDivs = reservDivs || this.e.querySelectorAll('div.hcal-reservation'); - for (var rdiv of reservDivs) { - var bounds = this.loopedOffsetOptimized(rdiv); - rdiv.addEventListener('mousemove', function(ev){ - var posAction = $this._getRerservationPositionAction(this, ev.layerX, ev.layerY); - if (posAction == HotelCalendar.ACTION.MOVE_LEFT || posAction == HotelCalendar.ACTION.MOVE_RIGHT) { - this.style.cursor = 'col-resize'; - } else if (posAction == HotelCalendar.ACTION.MOVE_DOWN) { - this.style.cursor = 'ns-resize'; - } else { - this.style.cursor = 'pointer'; - } - }, false); - var _funcEvent = function(ev){ - if ($this._isLeftButtonPressed(ev)) { - // MODE UNIFY RESERVATIONS - if ($this._selectionMode === HotelCalendar.ACTION.UNIFY) { - var reserv = $this.getReservation(this.dataset.hcalReservationObjId); - var dateLimits = $this.getDateLimits($this.reservationAction.toUnify, false); - var refUnifyReserv = ($this.reservationAction.toUnify.length > 0)?$this.reservationAction.toUnify[0]:false; - if ($this.reservationAction.toUnify.indexOf(reserv) != -1) { - $this.reservationAction.toUnify = _.reject($this.reservationAction.toUnify, function(item){ return item === reserv}); - this.classList.remove('hcal-reservation-unify-selected'); - } - else { - $this.reservationAction.toUnify.push(reserv); - this.classList.add('hcal-reservation-unify-selected'); - } - $this._updateHighlightUnifyReservations(); - } - else { - // ENABLE SWAP SELECTION - if (ev.ctrlKey || $this._modeSwap === HotelCalendar.MODE.SWAP_FROM) { - $this.reservationAction.action = HotelCalendar.ACTION.SWAP; - $this.setSwapMode(HotelCalendar.MODE.SWAP_FROM); - } - // MODE SWAP RESERVATIONS - if ($this.reservationAction.action === HotelCalendar.ACTION.SWAP) { - var reserv = $this.getReservation(this.dataset.hcalReservationObjId); - var refFromReserv = ($this.reservationAction.inReservations.length > 0)?$this.reservationAction.inReservations[0]:false; - var refToReserv = ($this.reservationAction.outReservations.length > 0)?$this.reservationAction.outReservations[0]:false; - - if (ev.ctrlKey || $this._modeSwap === HotelCalendar.MODE.SWAP_FROM) { - var canAdd = !((!refFromReserv && refToReserv && reserv.room.id === refToReserv.room.id) || (refFromReserv && reserv.room.id !== refFromReserv.room.id)); - // Can unselect - if ($this.reservationAction.inReservations.indexOf(reserv) != -1 && (($this.reservationAction.outReservations.length > 0 && $this.reservationAction.inReservations.length > 1) || $this.reservationAction.outReservations.length === 0)) { - $this.reservationAction.inReservations = _.reject($this.reservationAction.inReservations, function(item){ return item === reserv}); - this.classList.remove('hcal-reservation-swap-in-selected'); - } - // Can't add a 'out' reservation in 'in' list - else if ($this.reservationAction.outReservations.indexOf(reserv) == -1 && canAdd) { - $this.reservationAction.inReservations.push(reserv); - this.classList.add('hcal-reservation-swap-in-selected'); - } - } else if (!ev.ctrlKey || $this._modeSwap === HotelCalendar.MODE.SWAP_TO) { - $this.setSwapMode(HotelCalendar.MODE.SWAP_TO); - var canAdd = !((!refToReserv && refFromReserv && reserv.room.id === refFromReserv.room.id) || (refToReserv && reserv.room.id !== refToReserv.room.id)); - // Can unselect - if ($this.reservationAction.outReservations.indexOf(reserv) != -1) { - $this.reservationAction.outReservations = _.reject($this.reservationAction.outReservations, function(item){ return item === reserv; }); - this.classList.remove('hcal-reservation-swap-out-selected'); - } - // Can't add a 'in' reservation in 'out' list - else if ($this.reservationAction.inReservations.indexOf(reserv) == -1 && canAdd) { - $this.reservationAction.outReservations.push(reserv); - this.classList.add('hcal-reservation-swap-out-selected'); - } - } - $this._updateHighlightSwapReservations(); - } - // MODE RESIZE/MOVE RESERVATION - else if (!$this.reservationAction.reservation) { - $this.reservationAction = { - reservation: this, - mousePos: [ev.x, ev.y], - action: $this._getRerservationPositionAction(this, ev.layerX, ev.layerY), - inReservations: [], - outReservations: [], - }; - - // FIXME: Workaround for lazy selection operation - if ($this._lazyModeReservationsSelection) { - clearTimeout($this._lazyModeReservationsSelection); - $this._lazyModeReservationsSelection = false; - } - - $this._lazyModeReservationsSelection = setTimeout(function($this){ - var reserv = $this.getReservation(this.dataset.hcalReservationObjId); - $this._updateHighlightInvalidZones(reserv); - if (reserv.readOnly || (reserv.fixDays && ($this.reservationAction.action == HotelCalendar.ACTION.MOVE_LEFT - || $this.reservationAction.action == HotelCalendar.ACTION.MOVE_RIGHT))) { - $this.reservationAction.action = HotelCalendar.ACTION.NONE; - return false; - } - var affectedReservations = [reserv].concat($this.getLinkedReservations(reserv)); - for (var areserv of affectedReservations) { - if (areserv._html) { - areserv._html.classList.add('hcal-reservation-action'); - } - } - - var otherReservs = _.difference($this._reservations, affectedReservations); - for (var oreserv of otherReservs) { - if (oreserv._html) { - oreserv._html.classList.add('hcal-reservation-foreground'); - } - } - - $this._lazyModeReservationsSelection = false; - }.bind(this, $this), 175); - } - } - } - }; - rdiv.addEventListener('mousedown', _funcEvent, this._supportsPassive ? { passive: true } : false); - rdiv.addEventListener('touchstart', _funcEvent, this._supportsPassive ? { passive: true } : false); - rdiv.addEventListener('click', function(ev){ - $this._dispatchEvent( - 'hcalOnClickReservation', - { - 'event': ev, - 'reservationDiv': this, - 'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId) - }); - }, false); - rdiv.addEventListener('dblclick', function(ev){ - $this._dispatchEvent( - 'hcalOnDblClickReservation', - { - 'event': ev, - 'reservationDiv': this, - 'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId) - }); - }, false); - /* - rdiv.addEventListener('mouseenter', function(ev){ - $this._dispatchEvent( - 'hcalOnMouseEnterReservation', - { - 'event': ev, - 'reservationDiv': this, - 'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId) - }); - }, false); - rdiv.addEventListener('mouseleave', function(ev){ - $this._dispatchEvent( - 'hcalOnMouseLeaveReservation', - { - 'event': ev, - 'reservationDiv': this, - 'reservationObj': $this.getReservation(this.dataset.hcalReservationObjId) - }); - }, false); - */ - } - }, - - _getRerservationPositionAction: function(/*HTMLObject*/elm, /*Int*/posX, /*Int*/posY) { - var bounds = this.loopedOffsetOptimized(elm); - if (posX <= 4) { return HotelCalendar.ACTION.MOVE_LEFT; } - else if (posX >= bounds.width-8) { return HotelCalendar.ACTION.MOVE_RIGHT; } - else if (posY >= bounds.height-4) { return HotelCalendar.ACTION.MOVE_DOWN; } - return HotelCalendar.ACTION.MOVE_ALL; - }, - - _cleanUnusedZones: function(/*HReservationObject*/reserv) { - var unusedReservs = this.getLinkedReservations(reserv); - for (var unusedZone of unusedReservs) { - if (unusedZone._html && unusedZone._html.parentNode) { - unusedZone._html.parentNode.removeChild(unusedZone._html); - } - } - this._reservations = _.reject(this._reservations, {unusedZone: true, linkedId: reserv.id}); - }, - - _createUnusedZones: function(/*Array*/reservs) { - var nreservs = []; - for (var reserv of reservs) { - if (!reserv.unusedZone) { - var unused_id = 0; - var numBeds = reserv.getTotalPersons(false); - for (var e=numBeds; e reservationObj.room.capacity)) { - return false; - } - - if (reservationObj.room.id in this._reservationsMap) { - for (var r of this._reservationsMap[reservationObj.room.id]) { - if (!r.unusedZone && r !== reservationObj && reservationObj.room.number == r.room.number && - (_.difference(reservationObj._beds, r._beds).length != reservationObj._beds.length || this.options.divideRoomsByCapacity) && - (r.startDate.isBetween(reservationObj.startDate, reservationObj.endDate, 'day', '[)') || - r.endDate.isBetween(reservationObj.startDate, reservationObj.endDate, 'day', '(]') || - (reservationObj.startDate.isSameOrAfter(r.startDate, 'day') && reservationObj.endDate.isSameOrBefore(r.endDate, 'day')))) { - return false; - } - } - } - - return true; - }, - - getDates: function() { - return [this.options.startDate.clone(), this._endDate.clone()]; - }, - - //==== EVENT FUNCTIONS - _onInputChange: function(/*EventObject*/ev, /*HTMLObject*/elm) { - //var parentCell = this.edtable.querySelector(`#${elm.dataset.hcalParentCell}`); - //var parentRow = this.edtable.querySelector(`#${parentCell.dataset.hcalParentRow}`); - var value = elm.value; - var orgValue = elm.dataset.orgValue; - var name = elm.getAttribute('name'); - - if (name === 'room_type_price_day') { - if (!this._isNumeric(value)) { - elm.style.backgroundColor = 'red'; - } else if (orgValue !== value) { - elm.classList.add('hcal-input-changed'); - elm.style.backgroundColor = ''; - } else { - elm.classList.remove('hcal-input-changed'); - if (value == 0) { - elm.style.backgroundColor = 'rgb(255, 174, 174)'; - } - } - } - - var parentCell = this.edtable.querySelector(`#${elm.dataset.hcalParentCell}`); - var parentRow = this.edtable.querySelector(`#${parentCell.dataset.hcalParentRow}`); - var vals = { - 'room_type_id': +parentRow.dataset.hcalRoomTypeId, - 'date': HotelCalendar.toMoment(parentCell.dataset.hcalDate), - 'price': value, - 'old_price': orgValue, - 'pricelist_id': +parentRow.dataset.hcalPricelist - }; - //this.updateRoomTypePrice(vals['pricelist_id'], vals['room_type_id'], vals['date'], vals['price']); - this._dispatchEvent('hcalOnPricelistChanged', vals); - - if (this.edivc.querySelector('.hcal-input-changed') !== null) - { - this.btnSaveChanges.classList.add('need-save'); - this.btnSaveChanges.disabled = false; - } else { - this.btnSaveChanges.classList.remove('need-save'); - this.btnSaveChanges.disabled = true; - } - }, - - _onCellMouseUp: function(ev) { - if (this._selectionMode === HotelCalendar.ACTION.DIVIDE) { - if (this.reservationAction.reservation) { - var realEndDate = this.reservationAction.endDate.clone().subtract(1, 'd'); - if (this.reservationAction.action === HotelCalendar.ACTION.DIVIDE && !this.reservationAction.date.isSame(realEndDate, 'day')) { - var diff = this.getDateDiffDays(this.reservationAction.date, realEndDate); - this._dispatchEvent('hcalOnSplitReservation', { - reservation: this.reservationAction.reservation, - obj_id: this.reservationAction.obj_id, - date: this.reservationAction.date, - nights: diff - }) - this._reset_action_reservation(); - this.setSelectionMode(HotelCalendar.ACTION.NONE); - } - } - } - else if (this.reservationAction.action !== HotelCalendar.ACTION.NONE) { - return; - } - else if (this._cellSelection.start && - this._cellSelection.start.dataset.hcalParentRow === ev.target.dataset.hcalParentRow) { - this._cellSelection.end = ev.target; - this._dispatchEvent( - 'hcalOnChangeSelection', - { - 'cellStart': this._cellSelection.start, - 'cellEnd': this._cellSelection.end - }); - } - }, - - _onCellMouseDown: function(ev) { - if (this._selectionMode === HotelCalendar.ACTION.DIVIDE && this._splitReservation) { - this.reservationAction = { - reservation: this._splitReservation._html, - obj_id: this._splitReservation.id, - endDate: this._splitReservation.endDate, - action: this._selectionMode, - date: this._splitDate, - }; - this._splitReservation = false; - this._splitDate = false; - } else if ($(".marked-as-having-a-popover").length === 1) { - // TODO: better call _destroy_and_clear_popover_mark defined in hotel_calendar_controller.js - $(".marked-as-having-a-popover").popover('destroy'); - $('.hcal-reservation').removeClass("marked-as-having-a-popover"); - } else { - // FIXME: Prevent multiple clicks in a row - this._cellSelection.start = this._cellSelection.current = ev.target; - this._cellSelection.end = false; - this._updateCellSelection(); - } - }, - - _onCellMouseEnter: function(ev) { - var date_cell = HotelCalendar.toMoment(this.etable.querySelector(`#${ev.target.dataset.hcalParentCell}`).dataset.hcalDate); - var reserv; - if (this.reservationAction.reservation) { - reserv = this.getReservation(this.reservationAction.reservation.dataset.hcalReservationObjId); - if (!this.reservationAction.oldReservationObj) { - this.reservationAction.oldReservationObj = reserv.clone(); - this.reservationAction.daysOffset = this.getDateDiffDays(reserv.startDate.clone().local(), date_cell); - if (this.reservationAction.daysOffset < 0 ) { - this.reservationAction.daysOffset = 0; - } - } - } - if (this._selectionMode === HotelCalendar.MODE.NONE && this._isLeftButtonPressed(ev)) { - var toRoom = undefined; - var needUpdate = false; - if (!this.reservationAction.reservation) { - if (this._cellSelection.start && this._cellSelection.start.dataset.hcalParentRow === ev.target.dataset.hcalParentRow) { - this._cellSelection.current = ev.target; - } - this._updateCellSelection(); - } else if (this.reservationAction.mousePos) { - // workarround for not trigger reservation change - var a = this.reservationAction.mousePos[0] - ev.x; - var b = this.reservationAction.mousePos[1] - ev.y; - //var dist = Math.sqrt(a*a + b*b); - if (this.reservationAction.action == HotelCalendar.ACTION.MOVE_RIGHT) { - if (reserv.fixDays) { - this._reset_action_reservation(); - return true; - } - if (!date_cell.isAfter(reserv.startDate, 'd')) { - date_cell = reserv.startDate.clone().startOf('day'); - } - if (!this.reservationAction.oldReservationObj) { - this.reservationAction.oldReservationObj = reserv.clone(); - } - reserv.endDate.set({'date': date_cell.date(), 'month': date_cell.month(), 'year': date_cell.year()}).add(1, 'd'); - this.reservationAction.newReservationObj = reserv; - needUpdate = true; - } else if (this.reservationAction.action == HotelCalendar.ACTION.MOVE_LEFT) { - if (reserv.fixDays) { - this._reset_action_reservation(); - return true; - } - var ndate = reserv.endDate.clone().endOf('day').subtract(1, 'd'); - if (!date_cell.isBefore(ndate, 'd')) { - date_cell = ndate; - } - if (!this.reservationAction.oldReservationObj) { - this.reservationAction.oldReservationObj = reserv.clone(); - } - reserv.startDate.set({'date': date_cell.date(), 'month': date_cell.month(), 'year': date_cell.year()}); - this.reservationAction.newReservationObj = reserv; - needUpdate = true; - } else if (this.reservationAction.action == HotelCalendar.ACTION.MOVE_DOWN) { - var parentRow = ev.target.parentNode.parentNode.parentNode.parentNode; - var room = this.getRoom(parentRow.dataset.hcalRoomObjId); - - if (room.id === reserv.room.id) { - if (!this.reservationAction.oldReservationObj) { - this.reservationAction.oldReservationObj = reserv.clone(); - } - reserv.adults = +ev.target.dataset.hcalBedNum + 1; - this.reservationAction.newReservationObj = reserv; - needUpdate = true; - } - } else if (this.reservationAction.action == HotelCalendar.ACTION.MOVE_ALL) { - // Relative Movement - date_cell.subtract(this.reservationAction.daysOffset, 'd'); - - var parentRow = ev.target.parentNode.parentNode.parentNode.parentNode; - var room = this.getRoom(parentRow.dataset.hcalRoomObjId); - reserv.room = room; - var diff_date = this.getDateDiffDays(reserv.startDate, reserv.endDate); - reserv.startDate.set({'date': date_cell.date(), 'month': date_cell.month(), 'year': date_cell.year()}); - var date_end = reserv.startDate.clone().add(diff_date, 'd'); - reserv.endDate.set({'date': date_end.date(), 'month': date_end.month(), 'year': date_end.year()}); - this.reservationAction.newReservationObj = reserv; - toRoom = +ev.target.dataset.hcalBedNum; - needUpdate = true; - } - } - - if (needUpdate && reserv) { - _.defer(function(r){ this._updateScroll(r._html); }.bind(this), reserv) - - var affectedReservations = [reserv].concat(this.getLinkedReservations(this.reservationAction.newReservationObj)); - for (var areserv of affectedReservations) { - if (areserv !== reserv) { - areserv.startDate = reserv.startDate.clone(); - areserv.endDate = reserv.endDate.clone(); - } - - if (areserv._html) { - if (areserv.unusedZone) { - areserv._html.style.visibility = 'hidden'; - continue; - } - _.defer(function(ro, r, tro){ - this._calcReservationCellLimits( - r, - r===ro?tro:undefined, - !this.options.assistedMovement); - this._updateDivReservation(r); - - if (!r._limits.isValid() || !this.checkReservationPlace(r) || - (r.fixRooms && this.reservationAction.oldReservationObj.room.id != r.room.id) || - (r.fixDays && !this.reservationAction.oldReservationObj.startDate.isSame(r.startDate, 'day'))) { - r._html.classList.add('hcal-reservation-invalid'); - } - else { - r._html.classList.remove('hcal-reservation-invalid'); - } - }.bind(this), reserv, areserv, toRoom); - } - } - } - } else if (this._selectionMode === HotelCalendar.ACTION.DIVIDE) { - var parentRow = ev.target.parentNode.parentNode.parentNode.parentNode; - var room_id = parentRow.dataset.hcalRoomObjId; - var reservs = this.getReservationsByDay(date_cell, true, false, room_id); - if (this._divideDivs) { - this._divideDivs[0].remove(); - this._divideDivs[1].remove(); - this._divideDivs = false; - } - if (reservs.length) { - this._splitReservation = reservs[0]; - var defStyle = { - top: this._splitReservation._html.style.top, - left: this._splitReservation._html.style.left, - height: this._splitReservation._html.style.height, - }; - this._divideDivs = [ - $('
      ', {class: 'hcal-reservation-divide-l', css: defStyle}).appendTo(this.edivr), - $('
      ', {class: 'hcal-reservation-divide-r', css: defStyle}).appendTo(this.edivr) - ]; - var diff = this.getDateDiffDays(this._splitReservation.startDate, date_cell); - var boundsCell = false; - var beginCell = this.loopedOffsetOptimized(this._splitReservation._limits.left); - var endCell = this.loopedOffsetOptimized(this._splitReservation._limits.right); - this._splitDate = date_cell.clone(); - if (date_cell.isSame(this._splitReservation.endDate.clone().subtract(1, 'd'), 'day')) { - this._splitDate.subtract(1, 'd'); - var tcell = this.getCell(this._splitDate, this._splitReservation.room, 0); - if (tcell) { - boundsCell = this.loopedOffsetOptimized(tcell); - } else { - boundsCell = false; - this._splitReservation = false; - this._splitDate = false; - } - } else { - boundsCell = this.loopedOffsetOptimized(ev.target); - } - if (boundsCell) { - this._divideDivs[0][0].style.width = `${(boundsCell.left-beginCell.left)+boundsCell.width}px`; - this._divideDivs[1][0].style.left = `${(boundsCell.left-this._etableOffset.left)+boundsCell.width}px`; - this._divideDivs[1][0].style.width = `${(endCell.left-boundsCell.left)}px`; - } - } else { - this._splitReservation = false; - this._splitDate = false; - } - } - }, - - onMainKeyUp: function(/*EventObject*/ev) { - if (this.reservationAction.action === HotelCalendar.ACTION.SWAP || this.getSwapMode() !== HotelCalendar.MODE.NONE) { - var needReset = false; - if (ev.keyCode === 27) { - this.cancelSwap(); - } - else if (ev.keyCode === 13) { - this._dispatchSwapReservations(); - this._reset_action_reservation(); - this._updateHighlightSwapReservations(); - this._modeSwap = HotelCalendar.MODE.NONE; - } - else if (ev.keyCode === 17 && this.getSwapMode() === HotelCalendar.MODE.SWAP_FROM) { - this.setSwapMode(HotelCalendar.MODE.SWAP_TO); - } - } else if (this._selectionMode !== HotelCalendar.MODE.NONE) { - if (this._selectionMode === HotelCalendar.ACTION.UNIFY && (ev.keyCode === 13 || ev.keyCode === 27)) { - if (ev.keyCode === 13) { - this._dispatchUnifyReservations(); - } - this._reset_action_reservation(); - this._updateHighlightUnifyReservations(); - } - - if (ev.keyCode === 27 || ev.keyCode === 13) { - this.setSelectionMode(HotelCalendar.MODE.NONE); - } - } - }, - - onMainKeyDown: function(/*EventObject*/ev) { - if (this.reservationAction.action === HotelCalendar.ACTION.SWAP || this.getSwapMode() !== HotelCalendar.MODE.NONE) { - if (ev.keyCode === 17 && this.getSwapMode() === HotelCalendar.MODE.SWAP_TO) { - this.setSwapMode(HotelCalendar.MODE.SWAP_FROM); - } - } - }, - - onMainMouseUp: function(/*EventObject*/ev) { - if (this._lazyModeReservationsSelection) { - clearTimeout(this._lazyModeReservationsSelection); - this._lazyModeReservationsSelection = false; - } - _.defer(function(ev){ - if (this.reservationAction.reservation) { - var reservDiv = this.reservationAction.reservation; - reservDiv.classList.remove('hcal-reservation-action'); - this._updateHighlightInvalidZones(); - - var rdivs = this.e.querySelectorAll('div.hcal-reservation.hcal-reservation-foreground'); - for (var rd of rdivs) { rd.classList.remove('hcal-reservation-foreground'); } - - var reserv = this.getReservation(reservDiv.dataset.hcalReservationObjId); - var linkedReservations = this.getLinkedReservations(reserv); - var hasInvalidLink = false; - for (var r of linkedReservations) { - if (r._html) { - hasInvalidLink = !hasInvalidLink && r._html.classList.contains('hcal-reservation-invalid'); - r._html.classList.remove('hcal-reservation-action'); - r._html.classList.remove('hcal-reservation-invalid'); - r._html.style.visibility = ''; - } - } - - if (this.reservationAction.oldReservationObj && this.reservationAction.newReservationObj) { - if (!this.options.allowInvalidActions && (reservDiv.classList.contains('hcal-reservation-invalid') || hasInvalidLink)) { - this.replaceReservation(this.reservationAction.newReservationObj, this.reservationAction.oldReservationObj); - } else { - var oldReservation = this.reservationAction.oldReservationObj; - var newReservation = this.reservationAction.newReservationObj; - // Calc Old Reservation Price - var oldDiff = this.getDateDiffDays(oldReservation.startDate, oldReservation.endDate); - var oldPrice = 0.0 - for (var e=0; e> 16) & 255, (RGBint >> 8) & 255, RGBint & 255]; - }, - - _hueToRgb: function(/*Int*/v1, /*Int*/v2, /*Int*/h) { - if (h<0.0) { h+=1; } - if (h>1.0) { h-=1; } - if ((6.0*h) < 1.0) { return v1+(v2-v1)*6.0*h; } - if ((2.0*h) < 1.0) { return v2; } - if ((3.0*h) < 2.0) { return v1+(v2-v1)*((2.0/3.0)-h)*6.0; } - return v1; - }, - - _hslToRgb: function(/*Int*/h, /*Int*/s, /*Int*/l) { - if (s == 0.0) { - return [l,l,l]; - } - var v2 = l<0.5?l*(1.0+s):(l+s)-(s*l); - var v1 = 2.0*l-v2; - return [ - this._hueToRgb(v1,v2,h+(1.0/3.0)), - this._hueToRgb(v1,v2,h), - this._hueToRgb(v1,v2,h-(1.0/3.0))]; - }, - - _RGBToHex: function(/*Int*/r, /*Int*/g, /*Int*/b){ - var bin = r << 16 | g << 8 | b; - return (function(h){ - return new Array(7-h.length).join("0")+h; - })(bin.toString(16).toUpperCase()); - }, - - _hexToRGB: function(/*Int*/hex){ - var r = hex >> 16; - var g = hex >> 8 & 0xFF; - var b = hex & 0xFF; - return [r,g,b]; - }, - - _generateColor: function(/*Int*/value, /*Int*/max, /*Int*/offset, /*Bool*/reverse, /*Bool*/strmode) { - var rgb = [offset,1.0,0.5]; - if (value > max) { - if (!strmode) { - return rgb; - } - return "rgb("+Math.floor(rgb[0]*255)+","+Math.floor(rgb[1]*255)+","+Math.floor(rgb[2]*255)+")"; - } - if (reverse) { - value = max-value; - } - rgb = this._hslToRgb(((max-value)*offset)/max, 1.0, 0.8); - if (!strmode) { - return rgb; - } - return "rgb("+Math.floor(rgb[0]*255)+","+Math.floor(rgb[1]*255)+","+Math.floor(rgb[2]*255)+")"; - } -}; - -/** CONSTANTS **/ -HotelCalendar.DOMAIN = { NONE: -1, RESERVATIONS: 0, ROOMS: 1 }; -HotelCalendar.ACTION = { NONE: -1, MOVE_ALL: 0, MOVE_LEFT: 1, MOVE_RIGHT: 2, MOVE_DOWN: 3, SWAP: 4, DIVIDE: 5, UNIFY: 6 }; -HotelCalendar.MODE = { NONE: -1, SWAP_FROM: 0, SWAP_TO: 1 }; -HotelCalendar.DATE_FORMAT_SHORT_ = 'DD/MM/YYYY'; -HotelCalendar.DATE_FORMAT_LONG_ = HotelCalendar.DATE_FORMAT_SHORT_ + ' HH:mm:ss'; -/** STATIC METHODS **/ -HotelCalendar.toMoment = function(/*String,MomentObject*/ndate, /*String*/format) { - if (moment.isMoment(ndate)) { - return ndate; - } else if (typeof ndate === 'string' || ndate instanceof Date) { - ndate = moment(ndate, typeof format==='undefined'?HotelCalendar.DATE_FORMAT_LONG_:format); - if (moment.isMoment(ndate)) { - return ndate; - } - } - - //debugger; - console.warn('[Hotel Calendar][toMoment] Invalid date format!'); - return false; -} -HotelCalendar.toMomentUTC = function(/*String,MomentObject*/ndate, /*String*/format) { - if (moment.isMoment(ndate)) { - return ndate; - } else if (typeof ndate === 'string' || ndate instanceof Date) { - ndate = moment.utc(ndate, (typeof format==='undefined'?HotelCalendar.DATE_FORMAT_LONG_:format)); - if (moment.isMoment(ndate)) { - return ndate; - } - } - - //debugger; - console.warn('[Hotel Calendar][toMomentUTC] Invalid date format!'); - return false; -} - - -/** ROOM OBJECT **/ -function HRoom(/*Int*/id, /*String*/number, /*Int*/capacity, /*String*/type, /*Bool*/shared, /*List*/price) { - this.id = id || -1; - this.number = number || -1; - this.capacity = capacity || 1; - this.type = type || ''; - this.shared = shared; - this.price = price || false; - this.overbooking = false; - this.cancelled = false; - - this._html = false; - this._active = true; - this._userData = {}; -} -HRoom.prototype = { - clearUserData: function() { this._userData = {}; }, - getUserData: function(/*String?*/key) { - if (typeof key === 'undefined') { - return this._userData; - } - return key in this._userData && this._userData[key] || null; - }, - addUserData: function(/*Dictionary*/data) { - if (!_.isObject(data)) { - console.warn("[Hotel Calendar][HRoom][setUserData] Invalid Data! Need be a object!"); - } else { - this._userData = _.extend(this._userData, data); - } - }, - clone: function() { - var nroom = new HRoom( - this.id, - this.number, - this.capacity, - this.type, - this.shared, - this.price - ); - nroom.overbooking = this.overbooking; - nroom.cancelled = this.cancelled; - nroom._html = this._html; - nroom._active = this._active; - nroom.addUserData(this.getUserData()); - return nroom; - } -}; - -/** RESERVATION OBJECT **/ -function HReservation(/*Dictionary*/rValues) { - if (typeof rValues.room_id === 'undefined' && typeof rValues.room === 'undefined') { - delete this; - console.warn("[Hotel Calendar][HReservation] room can't be empty!"); - return; - } - - this.id = rValues.id; - this.room_id = rValues.room_id; - this.adults = rValues.adults || 1; - this.childrens = rValues.childrens || 0; - this.title = rValues.title || ''; - this.startDate = rValues.startDate || null; - this.endDate = rValues.endDate || null; - this.color = rValues.color || '#000'; - this.colorText = rValues.colorText || '#FFF'; - this.readOnly = rValues.readOnly || false; - this.fixRooms = rValues.fixRooms || false; - this.fixDays = rValues.fixDays || false; - this.unusedZone = rValues.unusedZone || false; - this.linkedId = rValues.linkedId || -1; - this.splitted = rValues.splitted || false; - this.overbooking = rValues.overbooking || false; - this.cancelled = rValues.cancelled || false; - this.room = rValues.room || null; - this.total_reservation = rValues.total_reservation || 0; - this.total_folio = rValues.total_folio || 0; - - this._drawModes = ['hard-start', 'hard-end']; - this._html = false; - this._limits = new HLimit(); - this._beds = []; - this._active = true; - this._userData = {}; -} -HReservation.prototype = { - setRoom: function(/*HRoomObject*/room) { this.room = room; }, - setStartDate: function(/*String,MomentObject*/date) { this.startDate = HotelCalendar.toMoment(date); }, - setEndDate: function(/*String,MomentObject*/date) { this.endDate = HotelCalendar.toMoment(date); }, - - clearUserData: function() { this._userData = {}; }, - getUserData: function(/*String?*/key) { - if (typeof key === 'undefined') { - return this._userData; - } - return key in this._userData && this._userData[key] || null; - }, - addUserData: function(/*Dictionary*/data) { - if (!_.isObject(data)) { - console.warn("[Hotel Calendar][HReservation][setUserData] Invalid Data! Need be a object!"); - } else { - this._userData = _.extend(this._userData, data); - } - }, - getTotalPersons: function(/*Boolean*/countChildrens) { - var persons = this.adults; - if (countChildrens) { - persons += this.childrens; - } - return persons; - }, - clone: function() { - var nreserv = new HReservation({ - 'id': this.id, - 'room': this.room?this.room.clone():null, - 'adults': this.adults, - 'childrens': this.childrens, - 'title': this.title, - 'startDate': this.startDate.clone(), - 'endDate': this.endDate.clone(), - 'color': this.color, - 'colorText': this.colorText, - 'readOnly': this.readOnly, - 'fixRooms': this.fixRooms, - 'fixDays': this.fixDays, - 'unusedZone': this.unusedZone, - 'linkedId': this.linkedId, - 'splitted': this.splitted, - 'overbooking': this.overbooking, - 'cancelled': this.cancelled, - 'room_id': this.room_id, - 'total_reservation': this.total_reservation, - 'total_folio': this.total_folio, - }); - nreserv._beds = _.clone(this._beds); - nreserv._html = this._html; - nreserv._drawModes = _.clone(this._drawModes); - nreserv._limits = this._limits.clone(); - nreserv._active = this._active; - nreserv.addUserData(this.getUserData()); - return nreserv; - } -}; - -/** LIMIT OBJECT **/ -function HLimit(/*HTMLObject*/left, /*HMTLObject*/right) { - this.left = left; - this.right = right; -} -HLimit.prototype = { - isSame: function() { - return this.left == this.right; - }, - isValid: function() { - return this.left && this.right; - }, - swap: function() { - var tt = this.left; - this.left = this.right; - this.right = tt; - }, - clone: function() { - return new HLimit(this.left, this.right); - } -}; diff --git a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js b/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js deleted file mode 100644 index 35d28cca1..000000000 --- a/hotel_calendar/static/src/lib/hcalendar/js/hcalendar_management.js +++ /dev/null @@ -1,1147 +0,0 @@ -/* global _, moment */ -'use strict'; -/* - * Hotel Calendar Management JS v0.0.1a - 2017-2018 - * GNU Public License - * Alexandre Díaz - * - * Dependencies: - * - moment - * - underscore - * - jquery !shit - * - bootbox !shit - * - bootstrap !shit - */ - -function HotelCalendarManagement(/*String*/querySelector, /*Dictionary*/options, /*HTMLObject?*/_base) { - if (window === this) { - return new HotelCalendarManagement(querySelector, options, _base); - } - - this.$base = (_base === 'undefined') ? document : _base; - - if (typeof querySelector === 'string') { - this.e = this.$base.querySelector(querySelector); - if (!this.e) { - return false; - } - } else if (typeof querySelector === 'object') { - this.e = querySelector; - } else { - return { - Version: '0.0.1a', - Author: "Alexandre Díaz", - Created: "24/09/2017", - Updated: "21/04/2018" - }; - } - - /** Strings **/ - this._strings = { - 'Open': 'Open', - 'Closed': 'Closed', - 'C. Departure': 'C. Departure', - 'C. Arrival': 'C. Arrival', - 'Price': 'Price', - 'Availability': 'Availability', - 'Min. Stay': 'Min. Stay', - 'Max. Stay': 'Max. Stay', - 'Min. Stay Arrival': 'Min. Stay Arrival', - 'Max. Stay Arrival': 'Max. Stay Arrival', - 'Clousure': 'Clousure', - 'Free Rooms': 'Free Rooms', - 'No OTA': 'No OTA', - 'Options': 'Options', - 'Reset': 'Reset', - 'Copy': 'Copy', - 'Paste': 'Paste', - 'Clone': 'Clone', - 'Cancel': 'Cancel' - }; - - /** Options **/ - if (!options) { options = {}; } - this.options = { - startDate: moment(options.startDate || new Date()), - days: options.days || moment(options.startDate || new Date()).daysInMonth(), - rooms: options.rooms || [], - endOfWeek: options.endOfWeek || 6, - endOfWeekOffset: options.endOfWeekOffset || 0, - currencySymbol: options.currencySymbol || '€', - dateFormatLong: options.dateFormat || 'YYYY-MM-DD HH:mm:ss', - dateFormatShort: options.dateFormat || 'YYYY-MM-DD', - translations: options.translations || [] - }; - - // Check correct values - if (this.options.rooms.length > 0 && !(this.options.rooms[0] instanceof HRoomType)) { - this.options.rooms = []; - console.warn("[Hotel Calendar Management][init] Invalid Room definiton!"); - } - - // Merge Transalations - for (var key in this.options.translations) { - this._strings[key] = this.options.translations[key]; - } - - /** Internal Values **/ - this.tableCreated = false; - this._pricelist = {}; - this._restrictions = {}; - this._availability = {}; - this._copy_values = {}; - this._mode = HotelCalendarManagement.MODE.ALL; - - /***/ - if (!this._create()) { - return false; - } - - return this; -} - -HotelCalendarManagement.prototype = { - /** PUBLIC MEMBERS **/ - addEventListener: function(/*String*/event, /*Function*/callback) { - this.e.addEventListener(event, callback); - }, - - hasChangesToSave: function() { - return this.e.querySelector('.hcal-management-record-changed') !== null; - }, - - //==== CALENDAR - setStartDate: function(/*String,MomentObject*/date, /*Int?*/days) { - var curDate = this.options.startDate; - if (moment.isMoment(date)) { - this.options.startDate = date; - } else if (typeof date === 'string'){ - this.options.startDate = moment(date); - } else { - console.warn("[Hotel Calendar Management][setStartDate] Invalid date format!"); - return; - } - - if (typeof days !== 'undefined') { - this.options.days = days; - } - - /*this.e.dispatchEvent(new CustomEvent( - 'hcOnChangeDate', - {'detail': {'prevDate':curDate, 'newDate': $this.options.startDate}}));*/ - this._updateView(); - }, - - getOptions: function(/*String?*/key) { - if (typeof key !== 'undefined') { - return this.options[key]; - } - return this.options; - }, - - setMode: function(/*Int*/mode) { - if (typeof mode === 'undefined') { - mode = this._mode; - } - if (mode === HotelCalendarManagement.MODE.LOW) { - this.etable.classList.remove('hcal-management-medium'); - this.etable.classList.add('hcal-management-low'); - this.edivrhl.classList.remove('hcal-management-medium'); - this.edivrhl.classList.add('hcal-management-low'); - this._mode = HotelCalendarManagement.MODE.LOW; - } else if (mode === HotelCalendarManagement.MODE.MEDIUM) { - this.etable.classList.remove('hcal-management-low'); - this.etable.classList.add('hcal-management-medium'); - this.edivrhl.classList.remove('hcal-management-low'); - this.edivrhl.classList.add('hcal-management-medium'); - this._mode = HotelCalendarManagement.MODE.MEDIUM; - } else { - this.etable.classList.remove('hcal-management-low'); - this.etable.classList.remove('hcal-management-medium'); - this.edivrhl.classList.remove('hcal-management-low'); - this.edivrhl.classList.remove('hcal-management-medium'); - this._mode = HotelCalendarManagement.MODE.ALL; - } - }, - - - /** PRIVATE MEMBERS **/ - //==== MAIN FUNCTIONS - _create: function() { - this.e.innerHTML = ""; - if (this.tableCreated) { - console.warn("[Hotel Calendar Management] Already created!"); - return false; - } - - /** Main Table **/ - this.etable = document.createElement("table"); - this.etable.classList.add('hcal-management-table'); - this.etable.classList.add('noselect'); - this.e.appendChild(this.etable); - this._updateView(); - this.tableCreated = true; - - return true; - }, - - _generateTableDay: function(/*HTMLObject*/parentCell) { - var $this = this; - var table = document.createElement("table"); - table.classList.add('hcal-management-table-day'); - table.classList.add('noselect'); - var row = false; - var cell = false; - var telm = false; - var roomId = $this.$base.querySelector(`#${parentCell.dataset.hcalParentRow}`).dataset.hcalRoomObjId; - var room = $this.getRoom(roomId); - var dateCell = HotelCalendarManagement.toMoment(parentCell.dataset.hcalDate); - var dateShortStr = dateCell.format(HotelCalendarManagement._DATE_FORMAT_SHORT); - - row = table.insertRow(); - row.setAttribute('name', 'price'); - - cell = row.insertCell(); - cell.setAttribute('colspan', '4'); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`PRICE_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'price'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Price')); - telm.value = room.price; - telm.dataset.orgValue = room.price; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - row = table.insertRow(); - row.setAttribute('name', 'avail'); - row.style.display = 'none'; - - cell = row.insertCell(); - cell.setAttribute('colspan', '1'); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`QUOTA_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'quota'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Availability Quota')); - telm.value = telm.dataset.orgValue = 0; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - cell = row.insertCell(); - cell.setAttribute('colspan', '1'); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`MAX_AVAIL_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'max_avail'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Max. Availability')); - telm.value = telm.dataset.orgValue = 0; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - cell = row.insertCell(); - cell.setAttribute('colspan', '1'); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`FREE_ROOMS_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'free_rooms'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Free Rooms')); - telm.setAttribute('readonly', 'readonly'); - telm.setAttribute('disabled', 'disabled'); - telm.style.backgroundColor = 'lightgray'; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - cell.appendChild(telm); - - cell = row.insertCell(); - cell.setAttribute('colspan', '1'); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`CHANNEL_AVAIL_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'channel_avail'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Channel Availability')); - telm.setAttribute('readonly', 'readonly'); - telm.setAttribute('disabled', 'disabled'); - telm.value = telm.dataset.orgValue = room.channel_avail; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - cell.appendChild(telm); - - row = table.insertRow(); - row.setAttribute('name', 'rest_a'); - - cell = row.insertCell(); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`MIN_STAY_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'min_stay'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Min. Stay')); - telm.dataset.orgValue = telm.value = 0; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.classList.add('hcal-border-radius-left'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - cell = row.insertCell(); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`MAX_STAY_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'max_stay'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Max. Stay')); - telm.dataset.orgValue = telm.value = 0; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.classList.add('hcal-border-radius-right'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - cell = row.insertCell(); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`MIN_STAY_ARRIVAL_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'min_stay_arrival'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Min. Stay Arrival')); - telm.dataset.orgValue = telm.value = 0; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.classList.add('hcal-border-radius-left'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - cell = row.insertCell(); - telm = document.createElement("input"); - telm.setAttribute('id', this._sanitizeId(`MAX_STAY_ARRIVAL_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'max_stay_arrival'); - telm.setAttribute('type', 'edit'); - telm.setAttribute('title', this._t('Max. Stay Arrival')); - telm.dataset.orgValue = telm.value = 0; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input'); - telm.classList.add('hcal-border-radius-right'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - - row = table.insertRow(); - row.setAttribute('name', 'rest_b'); - cell = row.insertCell(); - cell.setAttribute('colspan', '3'); - telm = document.createElement("select"); - telm.classList.add('hcal-management-input'); - telm.addEventListener('change', function(ev){ $this.onInputChange(ev, this); }, false); - telm.setAttribute('id', this._sanitizeId(`CLOUSURE_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'clousure'); - telm.setAttribute('title', this._t('Closure')); - telm.dataset.orgValue = 'open'; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - var selectOpt = document.createElement("option"); - selectOpt.value = "open"; - selectOpt.textContent = this._t("Open"); - telm.appendChild(selectOpt); - selectOpt = document.createElement("option"); - selectOpt.value = "closed"; - selectOpt.textContent = this._t("Closed"); - telm.appendChild(selectOpt); - selectOpt = document.createElement("option"); - selectOpt.value = "closed_departure"; - selectOpt.textContent = this._t("C. Departure"); - telm.appendChild(selectOpt); - selectOpt = document.createElement("option"); - selectOpt.value = "closed_arrival"; - selectOpt.textContent = this._t("C. Arrival"); - telm.appendChild(selectOpt); - cell.appendChild(telm); - - row = table.insertRow(); - row.setAttribute('name', 'rest_c'); - - cell = row.insertCell(); - cell.style.textAlign = 'center'; - cell.setAttribute('colspan', '4'); - telm = document.createElement("button"); - telm.setAttribute('id', this._sanitizeId(`NO_OTA_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'no_ota'); - telm.setAttribute('title', this._t('No OTA')); - telm.innerHTML = "No OTA"; - telm.dataset.orgValue = telm.dataset.state = 'false'; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - telm.classList.add('hcal-management-input', 'pull-left'); - telm.addEventListener('click', function(ev){ $this.onInputChange(ev, this); }, false); - cell.appendChild(telm); - telm = document.createElement("span"); - telm.setAttribute('id', this._sanitizeId(`OPTIONS_${roomId}_${dateShortStr}`)); - telm.setAttribute('name', 'options'); - telm.setAttribute('title', this._t('Options')); - telm.classList.add('dropdown', 'pull-right', 'hcal-management-record-options'); - telm.innerHTML = ` - - `; - telm.dataset.hcalParentCell = parentCell.getAttribute('id'); - cell.appendChild(telm); - - cell.querySelector('.hcal-record-option-clone').addEventListener('click', function(ev){ $this.onOptionsRecord(ev, this); }, false); - cell.querySelector('.hcal-record-option-reset').addEventListener('click', function(ev){ $this.onOptionsRecord(ev, this); }, false); - cell.querySelector('.hcal-record-option-copy').addEventListener('click', function(ev){ $this.onOptionsRecord(ev, this); }, false); - cell.querySelector('.hcal-record-option-paste').addEventListener('click', function(ev){ $this.onOptionsRecord(ev, this); }, false); - - - parentCell.appendChild(table); - - return table; - }, - - _getCell: function(/*HRoomObject*/room, /*DateTimeObject*/sdate) { - return this.e.querySelector(`#${this._sanitizeId(`${room.name}_${room.id}_${sdate.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`)}`); - }, - - setData: function(prices, restrictions, avail, count_free_rooms) { - //this._updateView(); - if (typeof prices !== 'undefined' && prices) { - this._pricelist = prices; - this._updatePriceList(); - } - if (typeof restrictions !== 'undefined' && restrictions) { - this._restrictions = restrictions; - this._updateRestrictions(); - } - if (typeof avail !== 'undefined' && avail) { - this.setAvailability(avail); - } - if (typeof count_free_rooms !== 'undefined' && count_free_rooms) { - this._free_rooms = count_free_rooms; - this._updateNumFreeRooms(); - } - }, - - setAvailability: function(avails) { - this._availability = avails; - if (this._availability) { - for (var elm of this.etable.querySelectorAll("tr[name=avail]")) { - elm.style.display = ""; - } - } - this._updateAvailability(); - }, - - //==== ROOMS - getRoom: function(/*String*/id) { - return _.find(this.options.rooms, function(item){ return item.id == id; }); - }, - - //==== RENDER FUNCTIONS - _create_table_data_days: function() { - var $this = this; - while (this.e.hasChildNodes()) { - this.e.removeChild(this.e.lastChild); - } - - // RoomType Names - this.edivrhl = document.createElement("div"); - this.edivrhl.classList.add('table-room_types'); - this.e.appendChild(this.edivrhl); - this.etableRooms = document.createElement("table"); - this.etableRooms.classList.add('hcal-management-table'); - this.etableRooms.classList.add('noselect'); - this.edivrhl.appendChild(this.etableRooms); - - // Container: Days + Data - this.edivm = document.createElement("div"); - this.edivm.setAttribute('id', 'hcal-management-container-dd'); - this.e.appendChild(this.edivm); - // Days - this.edivrh = document.createElement("div"); - this.edivrh.classList.add('table-room_type-data-header'); - this.edivm.appendChild(this.edivrh); - this.etableHeader = document.createElement("table"); - this.etableHeader.classList.add('hcal-management-table'); - this.etableHeader.classList.add('noselect'); - this.edivrh.appendChild(this.etableHeader); - // Data - this.edivr = document.createElement("div"); - this.edivr.classList.add('table-room_type-data'); - this.edivm.appendChild(this.edivr); - this.etable = document.createElement("table"); - this.etable.classList.add('hcal-management-table'); - this.etable.classList.add('noselect'); - this.edivr.appendChild(this.etable); - - /** TABLE HEADER **/ - var thead = this.etableHeader.createTHead(); - - // Render Next Days - var row = thead.insertRow(); - var now = moment().local(); - for (var i=0; i<=this.options.days; i++) { - var dd = this.options.startDate.clone().add(i,'d'); - var dd_local = dd.clone().local(); - var cell = row.insertCell(); - cell.setAttribute('id', this._sanitizeId(`hday_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`)); - cell.classList.add('hcal-cell-header-day'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-3d'); - cell.dataset.hcalDate = dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT); - cell.textContent = dd.format('D') + ' ' + dd.format('ddd') + ' (' + dd.format('MMM') + "'" + dd.format('YY') + ')'; - cell.setAttribute('title', dd.format('dddd')) - var day = +dd_local.format('D'); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= this.options.endOfWeek-this.options.endOfWeekOffset && dd_local.format('e') <= this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - - /** ROOM LINES **/ - var tbody = document.createElement("tbody"); - this.etableRooms.appendChild(tbody); - this.options.rooms.forEach(function(itemRoom, indexRoom){ - row = tbody.insertRow(); - cell = row.insertCell(); - cell.textContent = itemRoom.name; - cell.setAttribute('colspan', 2); - cell.classList.add('hcal-cell-room-type-group-item'); - cell.classList.add('btn-hcal'); - cell.classList.add('btn-hcal-3d'); - }); - - /** ROOM DATA LINES **/ - var tbody = document.createElement("tbody"); - this.etable.appendChild(tbody); - this.options.rooms.forEach(function(itemRoom, indexRoom){ - // Room Number - row = tbody.insertRow(); - row.setAttribute('id', $this._sanitizeId(`ROW_${itemRoom.name}_${itemRoom.id}`)); - row.dataset.hcalRoomObjId = itemRoom.id; - row.classList.add('hcal-row-room-type-group-item'); - for (var i=0; i<=$this.options.days; i++) { - var dd = $this.options.startDate.clone().add(i,'d'); - var dd_local = dd.clone().local(); - cell = row.insertCell(); - cell.setAttribute('id', $this._sanitizeId(`${itemRoom.name}_${itemRoom.id}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`)); - cell.classList.add('hcal-cell-room-type-group-item-day'); - cell.dataset.hcalParentRow = row.getAttribute('id'); - cell.dataset.hcalDate = dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT); - // Generate Interactive Table - cell.appendChild($this._generateTableDay(cell)); - //cell.innerHTML = dd.format("DD"); - var day = +dd_local.format("D"); - if (day == 1) { - cell.classList.add('hcal-cell-start-month'); - } - if (dd_local.isSame(now, 'day')) { - cell.classList.add('hcal-cell-current-day'); - } else if (dd_local.format('e') >= $this.options.endOfWeek-$this.options.endOfWeekOffset && dd_local.format('e') <= $this.options.endOfWeek) { - cell.classList.add('hcal-cell-end-week'); - } - } - }); - }, - - //==== PRICELIST - addPricelist: function(/*Object*/pricelist) { - var room_type_ids = Object.keys(pricelist); - for (var vid of room_type_ids) { - if (vid in this._pricelist) { - for (var price of pricelist[vid]) { - var index = _.findIndex(this._pricelist[vid], {date: price['date']}); - if (index >= 0) { - this._pricelist[vid][index] = price; - } else { - this._pricelist[vid].push(price); - } - } - } - else { - this._pricelist[vid] = pricelist[vid]; - } - } - this._updatePriceList(); - }, - - _updatePriceList: function() { - var keys = Object.keys(this._pricelist); - for (var room_typeId of keys) { - for (var price of this._pricelist[room_typeId]) { - var dd = HotelCalendarManagement.toMoment(price.date, this.options.dateFormatShort); - var inputId = this._sanitizeId(`PRICE_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`); - var input = this.etable.querySelector(`#${inputId}`); - if (input && !input.classList.contains('hcal-management-input-changed')) { - input.dataset.orgValue = price.price; - input.value = price.price; - } - } - } - }, - - getPricelist: function(onlyNew) { - var data = {}; - for (var room of this.options.rooms) { - for (var i=0; i<=this.options.days; i++) { - var ndate = this.options.startDate.clone().add(i, 'd'); - var ndateStr = ndate.format(HotelCalendarManagement._DATE_FORMAT_SHORT); - var inputId = this._sanitizeId(`PRICE_${room.id}_${ndateStr}`); - var input = this.etable.querySelector(`#${inputId}`); - if (!onlyNew || (onlyNew && input.value !== input.dataset.orgValue)) { - if (!(room.id in data)) { data[room.id] = []; } - data[room.id].push({ - 'date': ndate.format('YYYY-MM-DD'), - 'price': input.value - }); - } - } - } - return data; - }, - - //==== RESTRICTIONS - addRestrictions: function(/*Object*/restrictions) { - var room_type_ids = Object.keys(restrictions); - for (var vid of room_type_ids) { - if (vid in this._restrictions) { - for (var rest of restrictions[vid]) { - var index = _.findIndex(this._restrictions[vid], {date: rest['date']}); - if (index >= 0) { - this._restrictions[vid][index] = rest; - } else { - this._restrictions[vid].push(rest); - } - } - } - else { - this._restrictions[vid] = restrictions[vid]; - } - } - this._updateRestrictions(); - }, - - _updateRestrictions: function() { - var keys = Object.keys(this._restrictions); - for (var room_typeId of keys) { - var room = this.getRoom(room_typeId); - for (var restriction of this._restrictions[room_typeId]) { - var dd = HotelCalendarManagement.toMoment(restriction.date, this.options.dateFormatShort); - var inputIds = [ - this._sanitizeId(`MIN_STAY_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.min_stay, - this._sanitizeId(`MIN_STAY_ARRIVAL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.min_stay_arrival, - this._sanitizeId(`MAX_STAY_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.max_stay, - this._sanitizeId(`MAX_STAY_ARRIVAL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`), restriction.max_stay_arrival, - ]; - for (var i=0; i= 0) { - this._availability[vid][index] = avail; - } else { - this._availability[vid].push(avail); - } - } - } - else { - this._availability[vid] = availability[vid]; - } - } - this._updateAvailability(); - }, - - _updateAvailability: function() { - var keys = Object.keys(this._availability); - for (var room_typeId of keys) { - for (var avail of this._availability[room_typeId]) { - var dd = HotelCalendarManagement.toMoment(avail.date, this.options.dateFormatShort); - var inputIds = [ - `QUOTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.quota, - `MAX_AVAIL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.max_avail, - `CHANNEL_AVAIL_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.channel_avail, - `NO_OTA_${room_typeId}_${dd.format(HotelCalendarManagement._DATE_FORMAT_SHORT)}`, avail.no_ota - ]; - for (var i=0; i - - - -
      - Price: ${copy_values['price']}
      - Availability: ${copy_values['avail']}
      - Min. Stay: ${copy_values['min_stay']}
      - Max. Stay: ${copy_values['max_stay']}
      - Min. Stay Arrival: ${copy_values['min_stay_arrival']}
      - Max. Stay Arrival: ${copy_values['max_stay_arrival']}
      - Clousure: ${copy_values['clousure']}
      - No OTA: ${copy_values['no_ota']}
      -
      - - - - - FROM
      -
      - - - - -
      - - - TO
      -
      - - - - -
      - - - - - - - - - - `, - buttons: { - confirm : { - label: $this._t('Clone'), - className: "btn-success", - callback: function() { - var date_begin = $('table#hcal-management-clone-dates #date_begin').data("DateTimePicker").getDate().set({'hour': 0, 'minute': 0, 'second': 0}).clone(); - var date_end = $('table#hcal-management-clone-dates #date_end').data("DateTimePicker").getDate().set({'hour': 0, 'minute': 0, 'second': 0}).clone(); - var diff_days = $this.getDateDiffDays(date_begin, date_end) + 1; - var same_day = $('table#hcal-management-clone-dates #same_day').is(':checked'); - var cell_date = HotelCalendarManagement.toMoment(parentCell.dataset.hcalDate); - - var ndate = date_begin.clone(); - for (var i=0; i0)for(c in rd)d=rd[c],e=b[d],p(e)||(a[d]=e);return a} -// Moment prototype object -function r(b){q(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)), -// Prevent infinite loop in case updateOffset creates new moment -// objects. -sd===!1&&(sd=!0,a.updateOffset(this),sd=!1)}function s(a){return a instanceof r||null!=a&&null!=a._isAMomentObject}function t(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function u(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=t(b)),c} -// compare two arrays, return the number of differences -function v(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Dd[c]=Dd[c+"s"]=Dd[b]=a}function K(a){return"string"==typeof a?Dd[a]||Dd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)i(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Ed[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Ed[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)} -// MOMENTS -function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d} -// token: 'M' -// padded: ['MM', 2] -// ordinal: 'Mo' -// callback: function () { this.month() + 1 } -function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Id[a]=e),b&&(Id[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Id[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Fd);for(b=0,c=d.length;b=0&&Gd.test(a);)a=a.replace(Gd,c),Gd.lastIndex=0,d-=1;return a}function Z(a,b,c){$d[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return i($d,a)?$d[a](b._strict,b._locale):new RegExp(_(a))} -// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript -function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),f(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments)); -//the Date.UTC function remaps years 0-99 to 1900-1999 -return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b} -// start-of-first-week - start-of-year -function ua(a,b,c){var// first-week day -- which january is always in the first week (4 for iso, 1 for other) -d=7+b-c, -// first-week day local weekday -- which local weekday is fwd -e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1} -//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday -function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7} -// HELPERS -// LOCALES -function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy} -// MOMENTS -function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")} -// HELPERS -function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:this._weekdays}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=k([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){ -// test the regex -if( -// make the regex if we don't have it already -e=k([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}} -// MOMENTS -function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN; -// behaves the same as moment#day except -// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) -// as a setter, sunday should belong to the previous week. -if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ue),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ve),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=we),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++) -// make the regex if we don't have it already -c=k([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for( -// Sorting makes sure if one weekday (or abbr) is a prefix of another it -// will match the longer piece. -g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")} -// FORMATTING -function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})} -// PARSING -function Ua(a,b){return b._meridiemParse} -// LOCALES -function Va(a){ -// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays -// Using charAt should be more compatible. -return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a} -// pick the locale from the array -// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each -// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root -function Ya(a){for(var b,c,d,e,f=0;f0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1) -//the next array item is better than a shallower substring of this one -break;b--}f++}return null}function Za(a){var b=null; -// TODO: Find a better way to register and load all the locales in Node -if(!Be[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=xe._abbr,require("./locale/"+a), -// because defineLocale currently also sets the global locale, we -// want to undo that for lazy loaded locales -$a(b)}catch(a){}return Be[a]} -// This function will load locale and then set the global locale. If -// no arguments are passed in, it will simply return the current global -// locale key. -function $a(a,b){var c; -// moment.duration._locale = moment._locale = data; -return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}function _a(a,b){if(null!==b){var c=Ae;if(b.abbr=a,null!=Be[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Be[a]._config;else if(null!=b.parentLocale){if(null==Be[b.parentLocale])return Ce[b.parentLocale]||(Ce[b.parentLocale]=[]),Ce[b.parentLocale].push({name:a,config:b}),null;c=Be[b.parentLocale]._config} -// backwards compat for now: also set the locale -// make sure we set the locale AFTER all child locales have been -// created, so we won't end up with the child locale set. -return Be[a]=new C(B(c,b)),Ce[a]&&Ce[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Be[a]} -// useful for testing -return delete Be[a],null}function ab(a,b){if(null!=b){var c,d=Ae; -// MERGE -null!=Be[a]&&(d=Be[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Be[a],Be[a]=c, -// backwards compat for now: also set the locale -$a(a)}else -// pass null for config to unupdate, useful for tests -null!=Be[a]&&(null!=Be[a].parentLocale?Be[a]=Be[a].parentLocale:null!=Be[a]&&delete Be[a]);return Be[a]} -// returns locale data -function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return xe;if(!c(a)){if( -//short-circuit everything else -b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return wd(Be)}function db(a){var b,c=a._a;return c&&m(a).overflow===-2&&(b=c[be]<0||c[be]>11?be:c[ce]<1||c[ce]>ea(c[ae],c[be])?ce:c[de]<0||c[de]>24||24===c[de]&&(0!==c[ee]||0!==c[fe]||0!==c[ge])?de:c[ee]<0||c[ee]>59?ee:c[fe]<0||c[fe]>59?fe:c[ge]<0||c[ge]>999?ge:-1,m(a)._overflowDayOfYear&&(bce)&&(b=ce),m(a)._overflowWeeks&&b===-1&&(b=he),m(a)._overflowWeekday&&b===-1&&(b=ie),m(a).overflow=b),a} -// date from iso format -function eb(a){var b,c,d,e,f,g,h=a._i,i=De.exec(h)||Ee.exec(h);if(i){for(m(a).iso=!0,b=0,c=Ge.length;bpa(e)&&(m(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[be]=c.getUTCMonth(),a._a[ce]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b]; -// Zero out whatever was not defaulted, including time -for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b]; -// Check for 24:00:00.000 -24===a._a[de]&&0===a._a[ee]&&0===a._a[fe]&&0===a._a[ge]&&(a._nextDay=!0,a._a[de]=0),a._d=(a._useUTC?ta:sa).apply(null,f), -// Apply timezone offset from input. The actual utcOffset can be changed -// with parseZone. -null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[de]=24)}}function jb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4, -// TODO: We need to take the current isoWeekYear, but that depends on -// how we interpret now (local, utc, fixed offset). So create -// a now version of current config (take local/utc/offset flags, and -// create now). -c=gb(b.GG,a._a[ae],wa(sb(),1,4).year),d=gb(b.W,1),e=gb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(sb(),f,g);c=gb(b.gg,a._a[ae],j.year), -// Default to current week. -d=gb(b.w,j.week),null!=b.d?( -// weekday -- low day numbers are considered next week -e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?( -// local weekday -- counting starts from begining of week -e=b.e+f,(b.e<0||b.e>6)&&(i=!0)): -// default to begining of week -e=f}d<1||d>xa(c,f,g)?m(a)._overflowWeeks=!0:null!=i?m(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ae]=h.year,a._dayOfYear=h.dayOfYear)} -// date from string and format string -function kb(b){ -// TODO: Move this to another part of the creation flow to prevent circular deps -if(b._f===a.ISO_8601)return void eb(b);b._a=[],m(b).empty=!0; -// This array is used to make a Date, either with `new Date` or `Date.UTC` -var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Fd)||[],c=0;c0&&m(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length), -// don't parse if it's not a known token -Id[f]?(d?m(b).empty=!1:m(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&m(b).unusedTokens.push(f); -// add remaining unparsed input length to the string -m(b).charsLeftOver=i-j,h.length>0&&m(b).unusedInput.push(h), -// clear _12h flag if hour is <= 12 -b._a[de]<=12&&m(b).bigHour===!0&&b._a[de]>0&&(m(b).bigHour=void 0),m(b).parsedDateParts=b._a.slice(0),m(b).meridiem=b._meridiem, -// handle meridiem -b._a[de]=lb(b._locale,b._a[de],b._meridiem),ib(b),db(b)}function lb(a,b,c){var d; -// Fallback -return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b} -// date from string and array of format strings -function mb(a){var b,c,d,e,f;if(0===a._f.length)return m(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e -// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset -// +0200, so we adjust the time as needed, to be valid. -// -// Keeping the time actually adds/subtracts (one hour) -// from the actual represented time. That is why we call updateOffset -// a second time. In case it wants us to change the offset again -// _changeInProgress == true case, then we have to adjust, because -// there is no such time in the given timezone. -function Db(b,c){var d,e=this._offset||0;if(!this.isValid())return null!=b?this:NaN;if(null!=b){if("string"==typeof b){if(b=Ab(Xd,b),null===b)return this}else Math.abs(b)<16&&(b=60*b);return!this._isUTC&&c&&(d=Cb(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Tb(this,Ob(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?e:Cb(this)}function Eb(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Fb(a){return this.utcOffset(0,a)}function Gb(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Cb(this),"m")),this}function Hb(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var a=Ab(Wd,this._i);null!=a?this.utcOffset(a):this.utcOffset(0,!0)}return this}function Ib(a){return!!this.isValid()&&(a=a?sb(a).utcOffset():0,(this.utcOffset()-a)%60===0)}function Jb(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kb(){if(!p(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=pb(a),a._a){var b=a._isUTC?k(a._a):sb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Lb(){return!!this.isValid()&&!this._isUTC}function Mb(){return!!this.isValid()&&this._isUTC}function Nb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ob(a,b){var c,d,e,g=a, -// matching against regexp is expensive, do it on demand -h=null;// checks for null or undefined -return xb(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:f(a)?(g={},b?g[b]=a:g.milliseconds=a):(h=Ne.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:u(h[ce])*c,h:u(h[de])*c,m:u(h[ee])*c,s:u(h[fe])*c,ms:u(yb(1e3*h[ge]))*c}):(h=Oe.exec(a))?(c="-"===h[1]?-1:1,g={y:Pb(h[2],c),M:Pb(h[3],c),w:Pb(h[4],c),d:Pb(h[5],c),h:Pb(h[6],c),m:Pb(h[7],c),s:Pb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Rb(sb(g.from),sb(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new wb(g),xb(a)&&i(a,"_locale")&&(d._locale=a._locale),d}function Pb(a,b){ -// We'd normally use ~~inp for this, but unfortunately it also -// converts floats to ints. -// inp may be undefined, so careful calling replace on it. -var c=a&&parseFloat(a.replace(",",".")); -// apply sign while we're at it -return(isNaN(c)?0:c)*b}function Qb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Rb(a,b){var c;return a.isValid()&&b.isValid()?(b=Bb(b,a),a.isBefore(b)?c=Qb(a,b):(c=Qb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}} -// TODO: remove 'name' arg after deprecation is removed -function Sb(a,b){return function(c,d){var e,f; -//invert the arguments, but complain about it -return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ob(c,d),Tb(this,e,a),this}}function Tb(b,c,d,e){var f=c._milliseconds,g=yb(c._days),h=yb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Ub(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Vb(b,c){ -// We want to compare the start of today, vs this. -// Getting start-of-today depends on whether we're local/utc/offset or not. -var d=b||sb(),e=Bb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,sb(d)))}function Wb(){return new r(this)}function Xb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()f&&(b=f),Fc.call(this,a,b,c,d,e))}function Fc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this} -// MOMENTS -function Gc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)} -// HELPERS -// MOMENTS -function Hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Ic(a,b){b[ge]=u(1e3*("0."+a))} -// MOMENTS -function Jc(){return this._isUTC?"UTC":""}function Kc(){return this._isUTC?"Coordinated Universal Time":""}function Lc(a){return sb(1e3*a)}function Mc(){return sb.apply(null,arguments).parseZone()}function Nc(a){return a}function Oc(a,b,c,d){var e=bb(),f=k().set(d,b);return e[c](f,a)}function Pc(a,b,c){if(f(a)&&(b=a,a=void 0),a=a||"",null!=b)return Oc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Oc(a,d,c,"month");return e} -// () -// (5) -// (fmt, 5) -// (fmt) -// (true) -// (true, 5) -// (true, fmt, 5) -// (true, fmt) -function Qc(a,b,c,d){"boolean"==typeof a?(f(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,f(b)&&(c=b,b=void 0),b=b||"");var e=bb(),g=a?e._week.dow:0;if(null!=c)return Oc(b,(c+g)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Oc(b,(h+g)%7,d,"day");return i}function Rc(a,b){return Pc(a,b,"months")}function Sc(a,b){return Pc(a,b,"monthsShort")}function Tc(a,b,c){return Qc(a,b,c,"weekdays")}function Uc(a,b,c){return Qc(a,b,c,"weekdaysShort")}function Vc(a,b,c){return Qc(a,b,c,"weekdaysMin")}function Wc(){var a=this._data;return this._milliseconds=Ze(this._milliseconds),this._days=Ze(this._days),this._months=Ze(this._months),a.milliseconds=Ze(a.milliseconds),a.seconds=Ze(a.seconds),a.minutes=Ze(a.minutes),a.hours=Ze(a.hours),a.months=Ze(a.months),a.years=Ze(a.years),this}function Xc(a,b,c,d){var e=Ob(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()} -// supports only 2.0-style add(1, 's') or add(duration) -function Yc(a,b){return Xc(this,a,b,1)} -// supports only 2.0-style subtract(1, 's') or subtract(duration) -function Zc(a,b){return Xc(this,a,b,-1)}function $c(a){return a<0?Math.floor(a):Math.ceil(a)}function _c(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data; -// if we have a mix of positive and negative values, bubble down first -// check: https://github.com/moment/moment/issues/2166 -// The following code bubbles up values, see the tests for -// examples of what that means. -// convert days to months -// 12 months -> 1 year -return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*$c(bd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ad(g)),h+=e,g-=$c(bd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ad(a){ -// 400 years have 146097 days (taking into account leap year rules) -// 400 years have 12 months === 4800 -return 4800*a/146097}function bd(a){ -// the reverse of daysToMonths -return 146097*a/4800}function cd(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ad(b),"month"===a?c:c/12;switch( -// handle milliseconds separately because of floating point math errors (issue #1867) -b=this._days+Math.round(bd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3; -// Math.floor prevents floating point math errors here -case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}} -// TODO: Use this.as('ms')? -function dd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12)}function ed(a){return function(){return this.as(a)}}function fd(a){return a=K(a),this[a+"s"]()}function gd(a){return function(){return this._data[a]}}function hd(){return t(this.days()/7)} -// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize -function id(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function jd(a,b,c){var d=Ob(a).abs(),e=of(d.as("s")),f=of(d.as("m")),g=of(d.as("h")),h=of(d.as("d")),i=of(d.as("M")),j=of(d.as("y")),k=e0,k[4]=c,id.apply(null,k)} -// This function allows you to set the rounding function for relative time strings -function kd(a){return void 0===a?of:"function"==typeof a&&(of=a,!0)} -// This function allows you to set a threshold for relative time strings -function ld(a,b){return void 0!==pf[a]&&(void 0===b?pf[a]:(pf[a]=b,!0))}function md(a){var b=this.localeData(),c=jd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function nd(){ -// for ISO strings we do not use the normal bubbling rules: -// * milliseconds bubble up until they become hours -// * days do not bubble at all -// * months bubble up until they become years -// This is because there is no context-free conversion between hours and days -// (think of clock changes) -// and also not between days and months (28-31 days per month) -var a,b,c,d=qf(this._milliseconds)/1e3,e=qf(this._days),f=qf(this._months); -// 3600 seconds -> 60 minutes -> 1 hour -a=t(d/60),b=t(a/60),d%=60,a%=60, -// 12 months -> 1 year -c=t(f/12),f%=12; -// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js -var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var od,pd;pd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d68?1900:2e3)}; -// MOMENTS -var pe=O("FullYear",!0); -// FORMATTING -U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"), -// ALIASES -J("week","w"),J("isoWeek","W"), -// PRIORITIES -M("week",5),M("isoWeek",5), -// PARSING -Z("w",Od),Z("ww",Od,Kd),Z("W",Od),Z("WW",Od,Kd),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var qe={dow:0,// Sunday is the first day of the week. -doy:6}; -// FORMATTING -U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"), -// ALIASES -J("day","d"),J("weekday","e"),J("isoWeekday","E"), -// PRIORITY -M("day",11),M("weekday",11),M("isoWeekday",11), -// PARSING -Z("d",Od),Z("e",Od),Z("E",Od),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict); -// if we didn't get a weekday name, mark the date as invalid -null!=e?b.d=e:m(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)}); -// LOCALES -var re="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),se="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),te="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ue=Zd,ve=Zd,we=Zd;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1), -// ALIASES -J("hour","h"), -// PRIORITY -M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Od),Z("h",Od),Z("HH",Od,Kd),Z("hh",Od,Kd),Z("hmm",Pd),Z("hmmss",Qd),Z("Hmm",Pd),Z("Hmmss",Qd),ba(["H","HH"],de),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[de]=u(a),m(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d)),m(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e)),m(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e))});var xe,ye=/[ap]\.?m?\.?/i,ze=O("Hours",!0),Ae={calendar:xd,longDateFormat:yd,invalidDate:zd,ordinal:Ad,ordinalParse:Bd,relativeTime:Cd,months:le,monthsShort:me,week:qe,weekdays:re,weekdaysMin:te,weekdaysShort:se,meridiemParse:ye},Be={},Ce={},De=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ee=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fe=/Z|[+-]\d\d(?::?\d\d)?/,Ge=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/], -// YYYYMM is NOT allowed by the standard -["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],He=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ie=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=x("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}), -// constant that refers to the ISO standard -a.ISO_8601=function(){};var Je=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?athis?this:a:o()}),Le=function(){return Date.now?Date.now():+new Date};zb("Z",":"),zb("ZZ",""), -// PARSING -Z("Z",Xd),Z("ZZ",Xd),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ab(Xd,a)}); -// HELPERS -// timezone chunker -// '+10:00' > ['10', '00'] -// '-1530' > ['-15', '30'] -var Me=/([\+\-]|\d\d)/gi; -// HOOKS -// This function will be called whenever a moment is mutated. -// It is intended to keep the offset in sync with the timezone. -a.updateOffset=function(){}; -// ASP.NET json date format regex -var Ne=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Oe=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ob.fn=wb.prototype;var Pe=Sb(1,"add"),Qe=Sb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Re=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)}); -// FORMATTING -U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),zc("gggg","weekYear"),zc("ggggg","weekYear"),zc("GGGG","isoWeekYear"),zc("GGGGG","isoWeekYear"), -// ALIASES -J("weekYear","gg"),J("isoWeekYear","GG"), -// PRIORITY -M("weekYear",1),M("isoWeekYear",1), -// PARSING -Z("G",Vd),Z("g",Vd),Z("GG",Od,Kd),Z("gg",Od,Kd),Z("GGGG",Sd,Md),Z("gggg",Sd,Md),Z("GGGGG",Td,Nd),Z("ggggg",Td,Nd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}), -// FORMATTING -U("Q",0,"Qo","quarter"), -// ALIASES -J("quarter","Q"), -// PRIORITY -M("quarter",7), -// PARSING -Z("Q",Jd),ba("Q",function(a,b){b[be]=3*(u(a)-1)}), -// FORMATTING -U("D",["DD",2],"Do","date"), -// ALIASES -J("date","D"), -// PRIOROITY -M("date",9), -// PARSING -Z("D",Od),Z("DD",Od,Kd),Z("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),ba(["D","DD"],ce),ba("Do",function(a,b){b[ce]=u(a.match(Od)[0],10)}); -// MOMENTS -var Se=O("Date",!0); -// FORMATTING -U("DDD",["DDDD",3],"DDDo","dayOfYear"), -// ALIASES -J("dayOfYear","DDD"), -// PRIORITY -M("dayOfYear",4), -// PARSING -Z("DDD",Rd),Z("DDDD",Ld),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}), -// FORMATTING -U("m",["mm",2],0,"minute"), -// ALIASES -J("minute","m"), -// PRIORITY -M("minute",14), -// PARSING -Z("m",Od),Z("mm",Od,Kd),ba(["m","mm"],ee); -// MOMENTS -var Te=O("Minutes",!1); -// FORMATTING -U("s",["ss",2],0,"second"), -// ALIASES -J("second","s"), -// PRIORITY -M("second",15), -// PARSING -Z("s",Od),Z("ss",Od,Kd),ba(["s","ss"],fe); -// MOMENTS -var Ue=O("Seconds",!1); -// FORMATTING -U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}), -// ALIASES -J("millisecond","ms"), -// PRIORITY -M("millisecond",16), -// PARSING -Z("S",Rd,Jd),Z("SS",Rd,Kd),Z("SSS",Rd,Ld);var Ve;for(Ve="SSSS";Ve.length<=9;Ve+="S")Z(Ve,Ud);for(Ve="S";Ve.length<=9;Ve+="S")ba(Ve,Ic); -// MOMENTS -var We=O("Milliseconds",!1); -// FORMATTING -U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var Xe=r.prototype;Xe.add=Pe,Xe.calendar=Vb,Xe.clone=Wb,Xe.diff=bc,Xe.endOf=oc,Xe.format=gc,Xe.from=hc,Xe.fromNow=ic,Xe.to=jc,Xe.toNow=kc,Xe.get=R,Xe.invalidAt=xc,Xe.isAfter=Xb,Xe.isBefore=Yb,Xe.isBetween=Zb,Xe.isSame=$b,Xe.isSameOrAfter=_b,Xe.isSameOrBefore=ac,Xe.isValid=vc,Xe.lang=Re,Xe.locale=lc,Xe.localeData=mc,Xe.max=Ke,Xe.min=Je,Xe.parsingFlags=wc,Xe.set=S,Xe.startOf=nc,Xe.subtract=Qe,Xe.toArray=sc,Xe.toObject=tc,Xe.toDate=rc,Xe.toISOString=ec,Xe.inspect=fc,Xe.toJSON=uc,Xe.toString=dc,Xe.unix=qc,Xe.valueOf=pc,Xe.creationData=yc, -// Year -Xe.year=pe,Xe.isLeapYear=ra, -// Week Year -Xe.weekYear=Ac,Xe.isoWeekYear=Bc, -// Quarter -Xe.quarter=Xe.quarters=Gc, -// Month -Xe.month=ka,Xe.daysInMonth=la, -// Week -Xe.week=Xe.weeks=Ba,Xe.isoWeek=Xe.isoWeeks=Ca,Xe.weeksInYear=Dc,Xe.isoWeeksInYear=Cc, -// Day -Xe.date=Se,Xe.day=Xe.days=Ka,Xe.weekday=La,Xe.isoWeekday=Ma,Xe.dayOfYear=Hc, -// Hour -Xe.hour=Xe.hours=ze, -// Minute -Xe.minute=Xe.minutes=Te, -// Second -Xe.second=Xe.seconds=Ue, -// Millisecond -Xe.millisecond=Xe.milliseconds=We, -// Offset -Xe.utcOffset=Db,Xe.utc=Fb,Xe.local=Gb,Xe.parseZone=Hb,Xe.hasAlignedHourOffset=Ib,Xe.isDST=Jb,Xe.isLocal=Lb,Xe.isUtcOffset=Mb,Xe.isUtc=Nb,Xe.isUTC=Nb, -// Timezone -Xe.zoneAbbr=Jc,Xe.zoneName=Kc, -// Deprecations -Xe.dates=x("dates accessor is deprecated. Use date instead.",Se),Xe.months=x("months accessor is deprecated. Use month instead",ka),Xe.years=x("years accessor is deprecated. Use year instead",pe),Xe.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Eb),Xe.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Kb);var Ye=C.prototype;Ye.calendar=D,Ye.longDateFormat=E,Ye.invalidDate=F,Ye.ordinal=G,Ye.preparse=Nc,Ye.postformat=Nc,Ye.relativeTime=H,Ye.pastFuture=I,Ye.set=A, -// Month -Ye.months=fa,Ye.monthsShort=ga,Ye.monthsParse=ia,Ye.monthsRegex=na,Ye.monthsShortRegex=ma, -// Week -Ye.week=ya,Ye.firstDayOfYear=Aa,Ye.firstDayOfWeek=za, -// Day of Week -Ye.weekdays=Fa,Ye.weekdaysMin=Ha,Ye.weekdaysShort=Ga,Ye.weekdaysParse=Ja,Ye.weekdaysRegex=Na,Ye.weekdaysShortRegex=Oa,Ye.weekdaysMinRegex=Pa, -// Hours -Ye.isPM=Va,Ye.meridiem=Wa,$a("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}), -// Side effect imports -a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var Ze=Math.abs,$e=ed("ms"),_e=ed("s"),af=ed("m"),bf=ed("h"),cf=ed("d"),df=ed("w"),ef=ed("M"),ff=ed("y"),gf=gd("milliseconds"),hf=gd("seconds"),jf=gd("minutes"),kf=gd("hours"),lf=gd("days"),mf=gd("months"),nf=gd("years"),of=Math.round,pf={s:45,// seconds to minute -m:45,// minutes to hour -h:22,// hours to day -d:26,// days to month -M:11},qf=Math.abs,rf=wb.prototype; -// Deprecations -// Side effect imports -// FORMATTING -// PARSING -// Side effect imports -return rf.abs=Wc,rf.add=Yc,rf.subtract=Zc,rf.as=cd,rf.asMilliseconds=$e,rf.asSeconds=_e,rf.asMinutes=af,rf.asHours=bf,rf.asDays=cf,rf.asWeeks=df,rf.asMonths=ef,rf.asYears=ff,rf.valueOf=dd,rf._bubble=_c,rf.get=fd,rf.milliseconds=gf,rf.seconds=hf,rf.minutes=jf,rf.hours=kf,rf.days=lf,rf.weeks=hd,rf.months=mf,rf.years=nf,rf.humanize=md,rf.toISOString=nd,rf.toString=nd,rf.toJSON=nd,rf.locale=lc,rf.localeData=mc,rf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nd),rf.lang=Re,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Vd),Z("X",Yd),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.17.1",b(sb),a.fn=Xe,a.min=ub,a.max=vb,a.now=Le,a.utc=k,a.unix=Lc,a.months=Rc,a.isDate=g,a.locale=$a,a.invalid=o,a.duration=Ob,a.isMoment=s,a.weekdays=Tc,a.parseZone=Mc,a.localeData=bb,a.isDuration=xb,a.monthsShort=Sc,a.weekdaysMin=Vc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Uc,a.normalizeUnits=K,a.relativeTimeRounding=kd,a.relativeTimeThreshold=ld,a.calendarFormat=Ub,a.prototype=Xe,a}); \ No newline at end of file diff --git a/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml b/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml deleted file mode 100644 index c75e7ee68..000000000 --- a/hotel_calendar/static/src/xml/hotel_calendar_management_view.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - -
      -
      - -
      -
      -
      -
      - - - diff --git a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml b/hotel_calendar/static/src/xml/hotel_calendar_templates.xml deleted file mode 100644 index 4b579fafc..000000000 --- a/hotel_calendar/static/src/xml/hotel_calendar_templates.xml +++ /dev/null @@ -1,378 +0,0 @@ - diff --git a/hotel_calendar/static/src/xml/hotel_calendar_view.xml b/hotel_calendar/static/src/xml/hotel_calendar_view.xml deleted file mode 100644 index 832bb8bd0..000000000 --- a/hotel_calendar/static/src/xml/hotel_calendar_view.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - -
      - -
      -
      -
      -
      - - - diff --git a/hotel_calendar/tests/__init__.py b/hotel_calendar/tests/__init__.py deleted file mode 100644 index c9580b6f0..000000000 --- a/hotel_calendar/tests/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/hotel_calendar/tests/common.py b/hotel_calendar/tests/common.py deleted file mode 100644 index a0e771b14..000000000 --- a/hotel_calendar/tests/common.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- 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 . -# -############################################################################## -from odoo.addons.hotel.tests.common import TestHotel - - -class TestHotelCalendar(TestHotel): - - @classmethod - def setUpClass(cls): - super(TestHotelCalendar, cls).setUpClass() - - # Minimal Hotel Calendar Configuration - cls.tz_hotel = 'Europe/Madrid' - cls.default_pricelist_id = cls.pricelist_1.id - cls.default_restriction_id = cls.restriction_1.id - cls.env['ir.default'].sudo().set_default('res.config.settings', - 'default_arrival_hour', - '14:00') - cls.env['ir.default'].sudo().set_default('res.config.settings', - 'default_departure_hour', - '12:00') diff --git a/hotel_calendar/tests/test_management_calendar.py b/hotel_calendar/tests/test_management_calendar.py deleted file mode 100644 index 9a4b8b0e6..000000000 --- a/hotel_calendar/tests/test_management_calendar.py +++ /dev/null @@ -1,424 +0,0 @@ -# -*- 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 . -# -############################################################################## -from datetime import timedelta -from openerp.tools import ( - DEFAULT_SERVER_DATETIME_FORMAT, - DEFAULT_SERVER_DATE_FORMAT) -from openerp.exceptions import ValidationError -from .common import TestHotelCalendar -from odoo.addons.hotel import date_utils -import logging -_logger = logging.getLogger(__name__) - - -class TestManagementCalendar(TestHotelCalendar): - - def test_calendar_prices(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=15) - - room_types = (self.hotel_room_type_budget, self.hotel_room_type_special) - - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - for room_type in room_types: - for k_pr, v_pr in hcal_data['prices'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - if k_info >= len(self.prices_tmp[room_type.id]): - break - self.assertEqual(v_info['price'], - self.prices_tmp[room_type.id][k_info], - "Hotel Calendar Management Prices \ - doesn't match!") - - # REMOVE PRICES - prices_obj = self.env['product.pricelist.item'].sudo( - self.user_hotel_manager) - prod_tmpl_ids = ( - self.hotel_room_type_budget.product_id.product_tmpl_id.id, - self.hotel_room_type_special.product_id.product_tmpl_id.id - ) - pr_ids = prices_obj.search([ - ('pricelist_id', '=', self.default_pricelist_id), - ('product_tmpl_id', 'in', prod_tmpl_ids), - ]) - pr_ids.sudo(self.user_hotel_manager).unlink() - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - self.assertFalse(any(hcal_data['prices']), "Hotel Calendar Management \ - Prices doesn't match after remove!") - - def test_calendar_restrictions(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=15) - room_types = (self.hotel_room_type_budget, self.hotel_room_type_special) - - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - for room_type in room_types: - for k_pr, v_pr in hcal_data['restrictions'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - rest_items = self.restrictions_min_stay_tmp[room_type.id] - if k_info >= len(rest_items): - break - self.assertEqual( - v_info['min_stay'], - self.restrictions_min_stay_tmp[room_type.id][k_info], - "Hotel Calendar Management Restrictions \ - doesn't match!") - - # REMOVE RESTRICTIONS - rest_it_obj = self.env['hotel.room.type.restriction.item'].sudo( - self.user_hotel_manager) - rest_ids = rest_it_obj.search([ - ('restriction_id', '=', self.default_restriction_id), - ('room_type_id', 'in', (self.hotel_room_type_budget.id, - self.hotel_room_type_special.id)), - ]) - rest_ids.sudo(self.user_hotel_manager).unlink() - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - self.assertFalse( - any(hcal_data['restrictions']), - "Hotel Calendar Management Restrictions doesn't match \ - after remove!") - - def test_calendar_availability(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=6) - room_types = (self.hotel_room_type_budget, self.hotel_room_type_special) - - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - room_type_avail_obj = self.env['hotel.room.type.availability'].sudo( - self.user_hotel_manager) - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - for room_type in room_types: - for k_pr, v_pr in hcal_data['availability'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - if k_info >= len(self.avails_tmp[room_type.id]): - break - self.assertEqual( - v_info['avail'], - self.avails_tmp[room_type.id][k_info], - "Hotel Calendar Management Availability \ - doesn't match!") - - # CHANGE AVAIL - avail_ids = room_type_avail_obj.search([ - ('room_type_id', 'in', (self.hotel_room_type_budget.id, - self.hotel_room_type_special.id)), - ]) - for avail_id in avail_ids: - avail_id.sudo(self.user_hotel_manager).write({'avail': 1}) - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - for room_type in room_types: - for k_pr, v_pr in hcal_data['availability'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - self.assertEqual( - v_info['avail'], - 1, - "Hotel Calendar Management Availability \ - doesn't match!") - - # REMOVE AVAIL - avail_ids = room_type_avail_obj.search([ - ('room_type_id', 'in', (self.hotel_room_type_budget.id, - self.hotel_room_type_special.id)), - ]) - avail_ids.sudo(self.user_hotel_manager).unlink() - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - for room_type in room_types: - for k_pr, v_pr in hcal_data['availability'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - self.assertEqual( - v_info['avail'], - room_type.max_real_rooms, - "Hotel Calendar Management Availability \ - doesn't match!") - - def test_save_changes(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=3) - room_types = (self.hotel_room_type_budget,) - - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - - # Generate new prices - prices = (144.0, 170.0, 30.0, 50.0) - cprices = {} - for k_item, v_item in enumerate(prices): - ndate_utc_dt = now_utc_dt + timedelta(days=k_item) - cprices.setdefault(self.hotel_room_type_budget.id, []).append({ - 'date': ndate_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - 'price': v_item - }) - - # Generate new restrictions - restrictions = { - 'min_stay': (3, 2, 4, 1), - 'max_stay': (5, 8, 9, 3), - 'min_stay_arrival': (2, 3, 6, 2), - 'max_stay_arrival': (4, 7, 7, 4), - 'closed_departure': (False, True, False, True), - 'closed_arrival': (True, False, False, False), - 'closed': (False, False, True, True), - } - crestrictions = {} - for i in range(0, 4): - ndate_utc_dt = now_utc_dt + timedelta(days=i) - crestrictions.setdefault(self.hotel_room_type_budget.id, []).append({ - 'date': ndate_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - 'closed_arrival': restrictions['closed_arrival'][i], - 'max_stay': restrictions['max_stay'][i], - 'min_stay': restrictions['min_stay'][i], - 'closed_departure': restrictions['closed_departure'][i], - 'closed': restrictions['closed'][i], - 'min_stay_arrival': restrictions['min_stay_arrival'][i], - 'max_stay_arrival': restrictions['max_stay_arrival'][i], - }) - - # Generate new availability - avails = (1, 2, 2, 1) - cavails = {} - for k_item, v_item in enumerate(avails): - ndate_utc_dt = now_utc_dt + timedelta(days=k_item) - ndate_dt = date_utils.dt_as_timezone(ndate_utc_dt, self.tz_hotel) - cavails.setdefault(self.hotel_room_type_budget.id, []).append({ - 'date': ndate_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - 'avail': v_item, - 'no_ota': False, - }) - - # Save new values - hotel_cal_mngt_obj.save_changes( - self.default_pricelist_id, - self.default_restriction_id, - cprices, - crestrictions, - cavails) - - # Check data integrity - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - - for room_type in room_types: - for k_pr, v_pr in hcal_data['availability'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - self.assertEqual(v_info['avail'], - avails[k_info], - "Hotel Calendar Management \ - Availability doesn't match!") - for k_pr, v_pr in hcal_data['restrictions'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - self.assertEqual(v_info['min_stay'], - restrictions['min_stay'][k_info], - "Hotel Calendar Management \ - Restrictions doesn't match!") - self.assertEqual(v_info['max_stay'], - restrictions['max_stay'][k_info], - "Hotel Calendar Management \ - Restrictions doesn't match!") - self.assertEqual( - v_info['min_stay_arrival'], - restrictions['min_stay_arrival'][k_info], - "Hotel Calendar Management Restrictions \ - doesn't match!") - self.assertEqual( - v_info['max_stay_arrival'], - restrictions['max_stay_arrival'][k_info], - "Hotel Calendar Management Restrictions \ - doesn't match!") - self.assertEqual( - v_info['closed_departure'], - restrictions['closed_departure'][k_info], - "Hotel Calendar Management Restrictions \ - doesn't match!") - self.assertEqual( - v_info['closed_arrival'], - restrictions['closed_arrival'][k_info], - "Hotel Calendar Management Restrictions \ - doesn't match!") - self.assertEqual( - v_info['closed'], - restrictions['closed'][k_info], - "Hotel Calendar Management Restrictions \ - doesn't match!") - for k_pr, v_pr in hcal_data['prices'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - self.assertEqual(v_info['price'], - prices[k_info], "Hotel Calendar \ - Management Prices doesn't match!") - - def test_calendar_reservations(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=15) - room_types = (self.hotel_room_type_budget,) - - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - - reserv_start_utc_dt = now_utc_dt + timedelta(days=3) - reserv_end_utc_dt = reserv_start_utc_dt + timedelta(days=3) - folio = self.create_folio(self.user_hotel_manager, self.partner_2) - reservation = self.create_reservation( - self.user_hotel_manager, - folio, - reserv_start_utc_dt, - reserv_end_utc_dt, - self.hotel_room_simple_100, - "Reservation Test #1") - - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - - avail_end_utc_dt = reserv_end_utc_dt - timedelta(days=1) - for room_type in room_types: - for k_pr, v_pr in hcal_data['count_reservations'].iteritems(): - if k_pr == room_type.id: # Only Check Test Cases - for k_info, v_info in enumerate(v_pr): - ndate = date_utils.get_datetime(v_info['date']) - if date_utils.date_in(ndate, - reserv_start_utc_dt, - avail_end_utc_dt) == 0: - self.assertEqual(v_info['num'], - 1, - "Hotel Calendar Management \ - Availability doesn't match!") - - def test_invalid_input_calendar_data(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=15) - - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - - with self.assertRaises(ValidationError): - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - False, - adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - self.default_pricelist_id, - self.default_restriction_id, - True) - with self.assertRaises(ValidationError): - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - False, - self.default_pricelist_id, - self.default_restriction_id, - True) - with self.assertRaises(ValidationError): - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - False, - False, - self.default_pricelist_id, - self.default_restriction_id, - True) - hcal_data = hotel_cal_mngt_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT), - False, - False, - True) - self.assertTrue(any(hcal_data), "Hotel Calendar invalid default \ - management default models!") - - def test_calendar_settings(self): - hotel_cal_mngt_obj = self.env['hotel.calendar.management'].sudo( - self.user_hotel_manager) - settings = hotel_cal_mngt_obj.get_hcalendar_settings() - self.assertTrue(settings, "Hotel Calendar invalid settings") - - self.assertEqual(settings['eday_week'], - self.user_hotel_manager.npms_end_day_week, - "Hotel Calendar invalid settings") - self.assertEqual(settings['eday_week_offset'], - self.user_hotel_manager.npms_end_day_week_offset, - "Hotel Calendar invalid settings") - self.assertEqual(settings['days'], - self.user_hotel_manager.npms_default_num_days, - "Hotel Calendar invalid settings") - self.assertEqual(settings['show_notifications'], - self.user_hotel_manager.pms_show_notifications, - "Hotel Calendar invalid settings") - self.assertEqual(settings['show_num_rooms'], - self.user_hotel_manager.pms_show_num_rooms, - "Hotel Calendar invalid settings") diff --git a/hotel_calendar/tests/test_product_pricelist.py b/hotel_calendar/tests/test_product_pricelist.py deleted file mode 100644 index b1a86099a..000000000 --- a/hotel_calendar/tests/test_product_pricelist.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT -from .common import TestHotelCalendar -from odoo.addons.hotel import date_utils - - -class TestProductPricelist(TestHotelCalendar): - - def test_update_price(self): - now_utc_dt = date_utils.now() - now_utc_str = now_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - - room_type_tmpl_id = self.hotel_room_type_special.product_id.product_tmpl_id - - pritem_obj = self.env['product.pricelist.item'] - plitem = pritem_obj.search([ - ('pricelist_id', '=', self.default_pricelist_id), - ('product_tmpl_id', '=', room_type_tmpl_id.id), - ('date_start', '=', now_utc_str), - ('date_end', '=', now_utc_str), - ('applied_on', '=', '1_product'), - ('compute_price', '=', 'fixed') - ]) - old_price = plitem.fixed_price - - self.pricelist_1.update_price( - self.hotel_room_type_special.id, - now_utc_str, - 999.9) - - plitem = pritem_obj.search([ - ('pricelist_id', '=', self.default_pricelist_id), - ('product_tmpl_id', '=', room_type_tmpl_id.id), - ('date_start', '=', now_utc_str), - ('date_end', '=', now_utc_str), - ('applied_on', '=', '1_product'), - ('compute_price', '=', 'fixed') - ]) - new_price = plitem.fixed_price - - self.assertNotEqual(old_price, - new_price, - "Hotel Calendar can't change price") - self.assertEqual(new_price, - 999.9, - "Hotel Calendar can't change price") diff --git a/hotel_calendar/tests/test_reservations_calendar.py b/hotel_calendar/tests/test_reservations_calendar.py deleted file mode 100644 index fb149f2f1..000000000 --- a/hotel_calendar/tests/test_reservations_calendar.py +++ /dev/null @@ -1,289 +0,0 @@ -# -*- 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 . -# -############################################################################## -import datetime -from datetime import timedelta -from odoo import fields -from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT -from openerp.exceptions import ValidationError -from .common import TestHotelCalendar -from odoo.addons.hotel import date_utils -import pytz - - -class TestReservationsCalendar(TestHotelCalendar): - - def test_calendar_pricelist(self): - now_utc_dt = date_utils.now() - real_start_utc_dt = (now_utc_dt - timedelta(days=1)) - adv_utc_dt = now_utc_dt + timedelta(days=15) - - hotel_reserv_obj = self.env['hotel.reservation'].sudo( - self.user_hotel_manager) - - hcal_data = hotel_reserv_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) - - # Check Pricelist Integrity - for k_pr, v_pr in hcal_data['pricelist'].iteritems(): - for room_type_pr in v_pr: - # Only Check Test Cases - if room_type_pr['room'] in self.prices_tmp.keys(): - sorted_dates = sorted( - room_type_pr['days'].keys(), - key=lambda x: datetime.datetime.strptime(x, '%d/%m/%Y') - ) - init_date_dt = datetime.datetime.strptime( - sorted_dates[0], - '%d/%m/%Y').replace(tzinfo=pytz.utc) - end_date_dt = datetime.datetime.strptime( - sorted_dates[-1], - '%d/%m/%Y').replace(tzinfo=pytz.utc) - - self.assertEqual(real_start_utc_dt, init_date_dt, - "Hotel Calendar don't start in \ - the correct date!") - self.assertEqual(adv_utc_dt, end_date_dt, - "Hotel Calendar don't end in \ - the correct date!") - - room_type_prices = self.prices_tmp[room_type_pr['room']] - for k_price, v_price in enumerate(room_type_prices): - self.assertEqual( - v_price, - room_type_pr['days'][sorted_dates[k_price+1]], - "Hotel Calendar Pricelist doesn't match!") - - # Check Pricelist Integrity after unlink - pricelist_item_obj = self.env['product.pricelist.item'].sudo( - self.user_hotel_manager) - pr_ids = pricelist_item_obj.search([ - ('pricelist_id', '=', self.default_pricelist_id), - ('product_tmpl_id', 'in', ( - self.hotel_room_type_budget.product_id.product_tmpl_id.id, - self.hotel_room_type_special.product_id.product_tmpl_id.id)), - ]) - pr_ids.sudo(self.user_hotel_manager).unlink() - reserv_obj = self.env['hotel.reservation'].sudo( - self.user_hotel_manager) - hcal_data = reserv_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) - room_types = (self.hotel_room_type_budget, self.hotel_room_type_special) - for room_type in room_types: - for k_pr, v_pr in hcal_data['pricelist'].iteritems(): - for room_type_pr in v_pr: - if room_type_pr['room'] == room_type.id: # Only Check Test Cases - self.assertEqual( - room_type.list_price, - room_type_pr['days'][sorted_dates[k_price+1]], - "Hotel Calendar Pricelist doesn't \ - match after remove!") - - def test_calendar_reservations(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=15) - - hotel_reserv_obj = self.env['hotel.reservation'].sudo( - self.user_hotel_manager) - - def is_reservation_listed(reservation_id): - hcal_data = hotel_reserv_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) - # TODO: Perhaps not the best way to do this test... :/ - hasReservationTest = False - for reserv in hcal_data['reservations']: - if reserv[1] == reservation_id: - hasReservationTest = True - break - return hasReservationTest - - # CREATE COMPLETE RESERVATION (3 Nigths) - reserv_start_utc_dt = now_utc_dt + timedelta(days=3) - reserv_end_utc_dt = reserv_start_utc_dt + timedelta(days=3) - folio = self.create_folio(self.user_hotel_manager, self.partner_2) - reservation = self.create_reservation( - self.user_hotel_manager, - folio, - reserv_start_utc_dt, - reserv_end_utc_dt, - self.hotel_room_double_200, - "Reservation Test #1") - - # CHECK SUCCESSFULL CREATION - self.assertTrue(is_reservation_listed(reservation.id), - "Hotel Calendar can't found test reservation!") - - # CONFIRM FOLIO - folio.sudo(self.user_hotel_manager).action_confirm() - self.assertTrue(is_reservation_listed(reservation.id), - "Hotel Calendar can't found test reservation!") - - # CALENDAR LIMITS - now_utc_dt_tmp = now_utc_dt - adv_utc_dt_tmp = adv_utc_dt - # Start after reservation end - now_utc_dt = reserv_end_utc_dt + timedelta(days=2) - adv_utc_dt = now_utc_dt + timedelta(days=15) - self.assertFalse( - is_reservation_listed(reservation.id), - "Hotel Calendar found test reservation but expected not found it!") - - # Ends before reservation start - adv_utc_dt = reserv_start_utc_dt - timedelta(days=1) - now_utc_dt = adv_utc_dt - timedelta(days=15) - self.assertFalse( - is_reservation_listed(reservation.id), - "Hotel Calendar found test reservation but expected not found it!") - now_utc_dt = now_utc_dt_tmp - adv_utc_dt = adv_utc_dt_tmp - - # Start in the middle of the reservation days - now_utc_dt = reserv_end_utc_dt - timedelta(days=1) - adv_utc_dt = now_utc_dt + timedelta(days=15) - self.assertTrue( - is_reservation_listed(reservation.id), - "Hotel Calendar can't found test reservation!") - now_utc_dt = now_utc_dt_tmp - adv_utc_dt = adv_utc_dt_tmp - - # CANCEL FOLIO - folio.sudo(self.user_hotel_manager).action_cancel() - self.assertFalse( - is_reservation_listed(reservation.id), - "Hotel Calendar can't found test reservation!") - - # REMOVE FOLIO - folio.sudo().unlink() # FIXME: Can't use: self.user_hotel_manager - self.assertFalse( - is_reservation_listed(reservation.id), - "Hotel Calendar can't found test reservation!") - - def test_invalid_input_calendar_data(self): - now_utc_dt = date_utils.now() - adv_utc_dt = now_utc_dt + timedelta(days=15) - - hotel_reserv_obj = self.env['hotel.reservation'].sudo( - self.user_hotel_manager) - - with self.assertRaises(ValidationError): - hcal_data = hotel_reserv_obj.get_hcalendar_all_data( - False, - adv_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT)) - with self.assertRaises(ValidationError): - hcal_data = hotel_reserv_obj.get_hcalendar_all_data( - now_utc_dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT), - False) - with self.assertRaises(ValidationError): - hcal_data = hotel_reserv_obj.get_hcalendar_all_data( - False, - False) - - def test_calendar_settings(self): - hcal_options = self.env['hotel.reservation'].sudo( - self.user_hotel_manager).get_hcalendar_settings() - - self.assertEqual(hcal_options['divide_rooms_by_capacity'], - self.user_hotel_manager.pms_divide_rooms_by_capacity, - "Hotel Calendar Invalid Options!") - self.assertEqual(hcal_options['eday_week'], - self.user_hotel_manager.pms_end_day_week, - "Hotel Calendar Invalid Options!") - self.assertEqual(hcal_options['days'], - self.user_hotel_manager.pms_default_num_days, - "Hotel Calendar Invalid Options!") - self.assertEqual( - hcal_options['allow_invalid_actions'], - self.user_hotel_manager.pms_type_move == 'allow_invalid', - "Hotel Calendar Invalid Options!") - self.assertEqual( - hcal_options['assisted_movement'], - self.user_hotel_manager.pms_type_move == 'assisted', - "Hotel Calendar Invalid Options!") - default_arrival_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_arrival_hour') - self.assertEqual(hcal_options['default_arrival_hour'], - default_arrival_hour, - "Hotel Calendar Invalid Options!") - default_departure_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_departure_hour') - self.assertEqual(hcal_options['default_departure_hour'], - default_departure_hour, - "Hotel Calendar Invalid Options!") - self.assertEqual(hcal_options['show_notifications'], - self.user_hotel_manager.pms_show_notifications, - "Hotel Calendar Invalid Options!") - self.assertEqual(hcal_options['show_num_rooms'], - self.user_hotel_manager.pms_show_num_rooms, - "Hotel Calendar Invalid Options!") - self.assertEqual(hcal_options['show_pricelist'], - self.user_hotel_manager.pms_show_pricelist, - "Hotel Calendar Invalid Options!") - self.assertEqual(hcal_options['show_availability'], - self.user_hotel_manager.pms_show_availability, - "Hotel Calendar Invalid Options!") - - def test_swap_reservation(self): - hcal_reserv_obj = self.env['hotel.reservation'].sudo( - self.user_hotel_manager) - now_utc_dt = date_utils.now() - - # CREATE RESERVATIONS - reserv_start_utc_dt = now_utc_dt + timedelta(days=3) - reserv_end_utc_dt = reserv_start_utc_dt + timedelta(days=3) - folio_a = self.create_folio(self.user_hotel_manager, self.partner_2) - reservation_a = self.create_reservation( - self.user_hotel_manager, - folio_a, - reserv_start_utc_dt, - reserv_end_utc_dt, - self.hotel_room_double_200, - "Reservation Test #1") - self.assertTrue(reservation_a, - "Hotel Calendar create test reservation!") - folio_a.sudo(self.user_hotel_manager).action_confirm() - - folio_b = self.create_folio(self.user_hotel_manager, self.partner_2) - reservation_b = self.create_reservation( - self.user_hotel_manager, - folio_b, - reserv_start_utc_dt, - reserv_end_utc_dt, - self.hotel_room_simple_101, - "Reservation Test #2") - self.assertTrue(reservation_b, - "Hotel Calendar can't create test reservation!") - folio_b.sudo(self.user_hotel_manager).action_confirm() - - self.assertTrue( - hcal_reserv_obj.swap_reservations(reservation_a.ids, - reservation_b.ids), - "Hotel Calendar invalid swap operation" - ) - self.assertEqual(reservation_a.product_id.id, - self.hotel_room_simple_101.product_id.id, - "Hotel Calendar wrong swap operation") - self.assertEqual(reservation_b.product_id.id, - self.hotel_room_double_200.product_id.id, - "Hotel Calendar wrong swap operation") diff --git a/hotel_calendar/views/actions.xml b/hotel_calendar/views/actions.xml deleted file mode 100644 index 9bdf06417..000000000 --- a/hotel_calendar/views/actions.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Hotel folio checkin - hotel.reservation - tree,form - [('real_checkin','=', datetime.datetime.now().strftime('%Y-%m-%d')), - ('state', 'in', ['confirm']), - ('reservation_type', 'not in', ['out'])] - - - - Hotel folio checkout - hotel.reservation - tree,form - [('real_checkout','=', datetime.datetime.now().strftime('%Y-%m-%d')), - ('state', 'in', ['booking']), - ('reservation_type', 'not in', ['out'])] - - - - Hotel Calendar - hotel.calendar - tree,form - - - diff --git a/hotel_calendar/views/general.xml b/hotel_calendar/views/general.xml deleted file mode 100644 index 3ab647615..000000000 --- a/hotel_calendar/views/general.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - diff --git a/hotel_calendar/views/hotel_calendar_management_views.xml b/hotel_calendar/views/hotel_calendar_management_views.xml deleted file mode 100644 index 6d12c3abb..000000000 --- a/hotel_calendar/views/hotel_calendar_management_views.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - hotel.calendar.management.mpms - hotel.calendar.management - - - - - - diff --git a/hotel_calendar/views/hotel_calendar_views.xml b/hotel_calendar/views/hotel_calendar_views.xml deleted file mode 100644 index 24a3c8bea..000000000 --- a/hotel_calendar/views/hotel_calendar_views.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - hotel.calendar.form - hotel.calendar - -
      - - - - - - - - - - - - -
      -
      -
      - - - - hotel.calendar.tree - hotel.calendar - - - - - - - - -
      diff --git a/hotel_calendar/views/hotel_reservation_views.xml b/hotel_calendar/views/hotel_reservation_views.xml deleted file mode 100644 index 6c32e0a8b..000000000 --- a/hotel_calendar/views/hotel_reservation_views.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - hotel.reservation.pms - hotel.reservation - - - - - - diff --git a/hotel_calendar/views/inherited_hotel_property_views.xml b/hotel_calendar/views/inherited_hotel_property_views.xml deleted file mode 100644 index b774bcbd4..000000000 --- a/hotel_calendar/views/inherited_hotel_property_views.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - hotel.property - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hotel_calendar/views/inherited_hotel_room_type_views.xml b/hotel_calendar/views/inherited_hotel_room_type_views.xml deleted file mode 100644 index 9726a0d71..000000000 --- a/hotel_calendar/views/inherited_hotel_room_type_views.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - hotel.room.type - - - - - - - - - diff --git a/hotel_calendar/views/inherited_hotel_room_views.xml b/hotel_calendar/views/inherited_hotel_room_views.xml deleted file mode 100644 index 3d84684cb..000000000 --- a/hotel_calendar/views/inherited_hotel_room_views.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - hotel.room - - - - - - - - - diff --git a/hotel_calendar/views/inherited_res_company_views.xml b/hotel_calendar/views/inherited_res_company_views.xml deleted file mode 100644 index de31ddf29..000000000 --- a/hotel_calendar/views/inherited_res_company_views.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - view.company.form - res.company - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hotel_calendar/views/inherited_res_users_views.xml b/hotel_calendar/views/inherited_res_users_views.xml deleted file mode 100644 index 12c33f265..000000000 --- a/hotel_calendar/views/inherited_res_users_views.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - res.users - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hotel_calendar_channel_connector/README.md b/hotel_calendar_channel_connector/README.md deleted file mode 100644 index a102d4230..000000000 --- a/hotel_calendar_channel_connector/README.md +++ /dev/null @@ -1,12 +0,0 @@ -HOTEL CALENDAR CHANNEL CONNECTOR -=================================== -Unify 'hotel_calendar' and 'hotel_channel_connector' - - -Credits -======= - -Creator ------------- - -* Alexandre Díaz diff --git a/hotel_calendar_channel_connector/__init__.py b/hotel_calendar_channel_connector/__init__.py deleted file mode 100644 index 572903d95..000000000 --- a/hotel_calendar_channel_connector/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import models diff --git a/hotel_calendar_channel_connector/__manifest__.py b/hotel_calendar_channel_connector/__manifest__.py deleted file mode 100644 index a3cbe0835..000000000 --- a/hotel_calendar_channel_connector/__manifest__.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -{ - 'name': 'Hotel Calendar Channel Connector', - 'version': '11.0.2.0', - 'author': "Alexandre Díaz ", - 'website': 'https://github.com/hootel/hootel', - 'category': 'hotel/addon', - 'summary': "Hotel Calendar Channel Connector", - 'description': "Unify 'hotel_calendar' and 'hotel_channel_connector'", - 'depends': [ - 'hotel_calendar', - 'hotel_channel_connector', - ], - 'external_dependencies': { - 'python': [] - }, - 'data': [ - 'views/hotel_reservation.xml', - 'views/general.xml', - 'views/actions.xml', - ], - 'qweb': [ - 'static/src/xml/*.xml', - ], - 'test': [ - ], - - 'installable': True, - 'auto_install': True, - 'license': 'AGPL-3', -} diff --git a/hotel_calendar_channel_connector/i18n/es.po b/hotel_calendar_channel_connector/i18n/es.po deleted file mode 100644 index 9bcd96d2e..000000000 --- a/hotel_calendar_channel_connector/i18n/es.po +++ /dev/null @@ -1,88 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * hotel_calendar_channel_connector -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-03-13 21:59+0000\n" -"PO-Revision-Date: 2019-03-13 23:01+0100\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Language: es\n" -"X-Generator: Poedit 1.8.7.1\n" - -#. module: hotel_calendar_channel_connector -#: model:ir.actions.act_window,name:hotel_calendar_channel_connector.calendar_channel_connector_issues_action -msgid "Channel Connector Issues" -msgstr "Aviso de Conexión" - -#. module: hotel_calendar_channel_connector -#. openerp-web -#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml:30 -#, python-format -msgid "Channel:" -msgstr "Canal:" - -#. module: hotel_calendar_channel_connector -#: model:ir.model,name:hotel_calendar_channel_connector.model_hotel_reservation -msgid "Hotel Reservation" -msgstr "Reserva del hotel" - -#. module: hotel_calendar_channel_connector -#. openerp-web -#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml:11 -#, python-format -msgid "Issues" -msgstr "Avisos" - -#. module: hotel_calendar_channel_connector -#: model:ir.ui.view,arch_db:hotel_calendar_channel_connector.hotel_reservation_view_form -msgid "Mark as Read" -msgstr "Marcar como leído" - -#. module: hotel_calendar_channel_connector -#: model:ir.actions.act_window,name:hotel_calendar_channel_connector.hotel_reservation_action_manager_request -msgid "Reservations to Assign from Channel" -msgstr "Reservas por asignar" - -#. module: hotel_calendar_channel_connector -#. openerp-web -#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml:4 -#, python-format -msgid "Section:" -msgstr "Sección:" - -#. module: hotel_calendar_channel_connector -#. openerp-web -#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml:20 -#, python-format -msgid "To Assign" -msgstr "Por Asignar" - -#. module: hotel_calendar_channel_connector -#. openerp-web -#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml:11 -#, python-format -msgid "WuBook:" -msgstr "WuBook:" - -#. module: hotel_calendar_channel_connector -#: model:ir.model,name:hotel_calendar_channel_connector.model_bus_hotel_calendar -msgid "bus.hotel.calendar" -msgstr "bus.hotel.calendar" - -#. module: hotel_calendar_channel_connector -#: model:ir.model,name:hotel_calendar_channel_connector.model_hotel_calendar_management -msgid "hotel.calendar.management" -msgstr "hotel.calendar.management" - -#. module: hotel_calendar_channel_connector -#: model:ir.model,name:hotel_calendar_channel_connector.model_hotel_room_type_availability -msgid "hotel.room.type.availability" -msgstr "hotel.room.type.availability" diff --git a/hotel_calendar_channel_connector/models/__init__.py b/hotel_calendar_channel_connector/models/__init__.py deleted file mode 100644 index b67f6cb10..000000000 --- a/hotel_calendar_channel_connector/models/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright 2018-2019 Alexandre Díaz -# 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_calendar_management -from . import inherited_hotel_room_type_availability diff --git a/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py b/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py deleted file mode 100644 index 19c3f56bb..000000000 --- a/hotel_calendar_channel_connector/models/inherited_bus_hotel_calendar.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2018-2019 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging -from datetime import datetime -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT -from odoo import models, api -from odoo.addons.hotel_calendar.controllers.bus import HOTEL_BUS_CHANNEL_ID -_logger = logging.getLogger(__name__) - - -class BusHotelCalendar(models.TransientModel): - _inherit = 'bus.hotel.calendar' - - @api.model - def _generate_reservation_notif(self, vals): - notif = super(BusHotelCalendar, self)._generate_reservation_notif(vals) - reserv = self.env['hotel.reservation'].browse(vals['reserv_id']) - if any(reserv.channel_bind_ids): - notif['tooltip'].update({ - 'ota_name': reserv.channel_bind_ids[0].ota_id.name, - 'ota_reservation_id': reserv.channel_bind_ids[0].ota_reservation_id, - 'external_id': reserv.channel_bind_ids[0].external_id, - }) - elif reserv.splitted and reserv.parent_reservation.channel_bind_ids: - # chunks in splitted reservation has not channel_bind_ids - notif['tooltip'].update({ - 'ota_name': reserv.parent_reservation.channel_bind_ids[0].ota_id.name, - 'ota_reservation_id': reserv.parent_reservation.channel_bind_ids[0].ota_reservation_id, - 'external_id': reserv.parent_reservation.channel_bind_ids[0].external_id, - }) - return notif - - @api.model - def _generate_availability_notification(self, vals): - date_dt = datetime.strptime(vals['date'], DEFAULT_SERVER_DATE_FORMAT) - return { - 'type': 'availability', - 'availability': { - vals['room_type_id']: { - date_dt.strftime("%d/%m/%Y"): { - 'quota': vals['quota'], - 'max_avail': vals['max_avail'], - 'id': vals['id'], - 'no_ota': vals['no_ota'], - 'channel_avail': vals['channel_avail'], - }, - }, - }, - } - - @api.model - def send_availability_notification(self, vals): - notif = self._generate_availability_notification(vals) - self.env['bus.bus'].sendone((self._cr.dbname, 'hotel.reservation', - HOTEL_BUS_CHANNEL_ID), notif) - - @api.model - def _generate_issue_notification(self, ntype, title, issue_id, section, - message): - user_id = self.env['res.users'].browse(self.env.uid) - return { - 'type': 'issue', - 'subtype': ntype, - 'title': title, - 'username': user_id.partner_id.name, - 'userid': user_id.id, - 'issue': { - 'issue_id': issue_id, - 'section': section.upper(), - 'message': message, - }, - } - - @api.model - def send_issue_notification(self, ntype, title, issue_id, section, message): - notif = self._generate_issue_notification(ntype, title, issue_id, section, message) - self.env['bus.bus'].sendone( - (self._cr.dbname, 'hotel.reservation', - HOTEL_BUS_CHANNEL_ID), notif) - diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py b/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py deleted file mode 100644 index b447e5a23..000000000 --- a/hotel_calendar_channel_connector/models/inherited_hotel_calendar_management.py +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright 2019 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from datetime import timedelta -from odoo import models, api, fields -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT - - -class HotelCalendarManagement(models.TransientModel): - _inherit = 'hotel.calendar.management' - - @api.model - def _hcalendar_availability_json_data(self, dfrom, dto): - date_start = fields.Date.from_string(dfrom) - date_end = fields.Date.from_string(dto) - date_diff = abs((date_end - date_start).days) + 1 - hotel_room_type_avail_obj = self.env['hotel.room.type.availability'] - room_types = self.env['hotel.room.type'].search([]) - json_data = {} - - for room_type in room_types: - json_data[room_type.id] = [] - for i in range(0, date_diff): - cur_date = date_start + timedelta(days=i) - cur_date_str = cur_date.strftime(DEFAULT_SERVER_DATE_FORMAT) - avail = hotel_room_type_avail_obj.search([ - ('date', '=', cur_date_str), - ('room_type_id', '=', room_type.id) - ]) - json_data[room_type.id].append( - self._generate_avalaibility_data(room_type, cur_date_str, avail)) - return json_data - - @api.model - def _generate_avalaibility_data(self, room_type, date, avail): - avalaibility_data = { - 'id': False, - 'date': date, - 'no_ota': False, - 'quota': room_type.channel_bind_ids.default_quota, - 'max_avail': room_type.channel_bind_ids.default_max_avail, - 'channel_avail': room_type.channel_bind_ids.default_availability - } - if avail: - avalaibility_data = { - 'id': avail.id, - 'date': avail.date, - 'no_ota': avail.no_ota, - 'quota': avail.quota, - 'max_avail': avail.max_avail, - 'channel_avail': avail.channel_bind_ids.channel_avail - } - return avalaibility_data - - @api.model - def _get_availability_values(self, vals): - vals = { - 'quota': vals['quota'], - 'max_avail': vals['max_avail'], - 'no_ota': vals['no_ota'], - } - return vals - - - def save_changes(self, pricelist_id, restriction_id, pricelist, - restrictions, availability={}): - res = super(HotelCalendarManagement, self).save_changes( - pricelist_id, - restriction_id, - pricelist, - restrictions, - availability=availability) - - room_type_obj = self.env['hotel.room.type'] - room_type_avail_obj = self.env['hotel.room.type.availability'] - # Save Availability - for k_avail in availability.keys(): - room_type_id = room_type_obj.browse(int(k_avail)) - for avail in availability[k_avail]: - vals = self._get_availability_values(avail) - avail_id = room_type_avail_obj.search([ - ('date', '=', avail['date']), - ('room_type_id', '=', room_type_id.id), - ], limit=1) - if not avail_id: - vals.update({ - 'date': avail['date'], - 'room_type_id': room_type_id.id, - }) - avail_id = room_type_avail_obj.with_context({ - 'mail_create_nosubscribe': True, - }).create(vals) - else: - avail_id.write(vals) - - self.env['channel.backend'].cron_push_changes() - return res - - @api.model - def get_hcalendar_all_data(self, dfrom, dto, pricelist_id, restriction_id, - withRooms): - res = super(HotelCalendarManagement, self).get_hcalendar_all_data( - dfrom, dto, pricelist_id, restriction_id, withRooms) - json_avails = self._hcalendar_availability_json_data(dfrom, dto) - res.update({ - 'availability': json_avails or [], - }) - return res diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py b/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py deleted file mode 100644 index 1b2ca9477..000000000 --- a/hotel_calendar_channel_connector/models/inherited_hotel_reservation.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging -from odoo import models, api -_logger = logging.getLogger(__name__) - - -class HotelReservation(models.Model): - _inherit = "hotel.reservation" - - - def _hcalendar_reservation_data(self, reservations): - vals = super(HotelReservation, self)._hcalendar_reservation_data(reservations) - # TODO: Improve performance by doing a SQL as in get_hcalendar_reservations_data() - hotel_reservation_obj = self.env['hotel.reservation'] - for v_rval in vals[0]: - reserv = hotel_reservation_obj.browse(v_rval['id']) - v_rval.update({ - 'fix_days': reserv.splitted or reserv.is_from_ota, - }) - # Update tooltips - if any(reserv.channel_bind_ids): - vals[1][reserv.id].update({ - 'ota_name': reserv.channel_bind_ids[0].ota_id.name, - 'ota_reservation_id': reserv.channel_bind_ids[0].ota_reservation_id, - 'external_id': reserv.channel_bind_ids[0].external_id, - }) - elif reserv.splitted and reserv.parent_reservation.channel_bind_ids: - # chunks in splitted reservation has not channel_bind_ids - vals[1][reserv.id].update({ - 'ota_name': reserv.parent_reservation.channel_bind_ids[0].ota_id.name, - 'ota_reservation_id': reserv.parent_reservation.channel_bind_ids[0].ota_reservation_id, - 'external_id': reserv.parent_reservation.channel_bind_ids[0].external_id, - }) - # REVIEW: What happens if the reservation is splitted and no parent with channel_bind_ids ¿? - return vals - - - def generate_bus_values(self, naction, ntype, ntitle=''): - self.ensure_one() - vals = super(HotelReservation, self).generate_bus_values(naction, ntype, ntitle) - vals.update({ - 'fix_days': self.splitted or self.is_from_ota, - }) - if any(self.channel_bind_ids): - vals.update({ - 'ota_name': self.channel_bind_ids[0].ota_id.name, - 'ota_reservation_id': self.channel_bind_ids[0].ota_reservation_id, - 'external_id': self.channel_bind_ids[0].external_id, - }) - return vals - - - def confirm(self): - for record in self: - if record.to_assign: - record.write({'to_assign': False}) - return super(HotelReservation, self).confirm() diff --git a/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py b/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py deleted file mode 100644 index 247cf6b78..000000000 --- a/hotel_calendar_channel_connector/models/inherited_hotel_room_type_availability.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2018-2019 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api - - -class HotelRoomTypeAvailability(models.Model): - _inherit = 'hotel.room.type.availability' - - def _prepare_notif_values(self, record): - return { - 'date': record.date, - 'quota': record.quota, - 'no_ota': record.no_ota, - 'max_avail': record.max_avail, - 'room_type_id': record.room_type_id.id, - 'id': record.id, - 'channel_avail': record.channel_bind_ids.channel_avail, - } - - @api.model - def create(self, vals): - res = super(HotelRoomTypeAvailability, self).create(vals) - self.env['bus.hotel.calendar'].send_availability_notification( - self._prepare_notif_values(res) - ) - return res - - - def write(self, vals): - ret_vals = super(HotelRoomTypeAvailability, self).write(vals) - bus_hotel_calendar_obj = self.env['bus.hotel.calendar'] - for record in self: - bus_hotel_calendar_obj.send_availability_notification( - self._prepare_notif_values(record) - ) - return ret_vals - - - def unlink(self): - # Construct dictionary with relevant info of removed records - unlink_vals = [] - for record in self: - unlink_vals.append( - self._prepare_notif_values(record) - ) - res = super(HotelRoomTypeAvailability, self).unlink() - bus_hotel_calendar_obj = self.env['bus.hotel.calendar'] - for uval in unlink_vals: - bus_hotel_calendar_obj.send_availability_notification(uval) - return res diff --git a/hotel_calendar_channel_connector/readme/CONTRIBUTORS.rst b/hotel_calendar_channel_connector/readme/CONTRIBUTORS.rst deleted file mode 100644 index 55873688c..000000000 --- a/hotel_calendar_channel_connector/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1 +0,0 @@ -* Alexandre Díaz diff --git a/hotel_calendar_channel_connector/readme/DESCRIPTION.rst b/hotel_calendar_channel_connector/readme/DESCRIPTION.rst deleted file mode 100644 index 10d829e13..000000000 --- a/hotel_calendar_channel_connector/readme/DESCRIPTION.rst +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index e69de29bb..000000000 diff --git a/hotel_calendar_channel_connector/readme/USAGE.rst b/hotel_calendar_channel_connector/readme/USAGE.rst deleted file mode 100644 index ede695e0e..000000000 --- a/hotel_calendar_channel_connector/readme/USAGE.rst +++ /dev/null @@ -1 +0,0 @@ -No configuration required diff --git a/hotel_calendar_channel_connector/static/description/eiqui_logo.png b/hotel_calendar_channel_connector/static/description/eiqui_logo.png deleted file mode 100644 index ca3bd8c13..000000000 Binary files a/hotel_calendar_channel_connector/static/description/eiqui_logo.png and /dev/null differ diff --git a/hotel_calendar_channel_connector/static/description/index.html b/hotel_calendar_channel_connector/static/description/index.html deleted file mode 100644 index 9022331a1..000000000 --- a/hotel_calendar_channel_connector/static/description/index.html +++ /dev/null @@ -1,22 +0,0 @@ -
      -
      -
      -
      -

      HOTEL CALENDAR WUBOOK

      -

      Hotel Calendar WuBook

      -
      -
      -

      Hotel Calendar WuBook

      -
      - -
      - -
      -
      - - - -
      -
      -
      -
      diff --git a/hotel_calendar_channel_connector/static/sfx/book_cancelled.mp3 b/hotel_calendar_channel_connector/static/sfx/book_cancelled.mp3 deleted file mode 100644 index 10ffab8e7..000000000 Binary files a/hotel_calendar_channel_connector/static/sfx/book_cancelled.mp3 and /dev/null differ diff --git a/hotel_calendar_channel_connector/static/sfx/book_new.mp3 b/hotel_calendar_channel_connector/static/sfx/book_new.mp3 deleted file mode 100644 index 86cd208a1..000000000 Binary files a/hotel_calendar_channel_connector/static/sfx/book_new.mp3 and /dev/null differ diff --git a/hotel_calendar_channel_connector/static/src/css/view.css b/hotel_calendar_channel_connector/static/src/css/view.css deleted file mode 100644 index 6ab3526c9..000000000 --- a/hotel_calendar_channel_connector/static/src/css/view.css +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Hotel Calendar JS v0.0.1a - 2017 - * GNU Public License - * Aloxa Solucions S.L. - * Alexandre Díaz - */ - - /** ANIMATIONS **/ - @keyframes channel-manager-changes { - 0% { - color: red; - } - 5% { - transform: rotate(10deg); - } - 10% { - transform: rotate(0deg); - } - 15% { - transform: rotate(-10deg); - } - 20% { - transform: rotate(0deg); - } - 100% { - color: yellow; - } -} -@keyframes channel-manager-changes-text { - from { - color: white; - } - to { - color: black; - } -} - -#pms-menu #btn_channel_manager_request .incoming i { - animation-name: channel-manager-changes; - animation-duration: 2s; - animation-iteration-count: infinite; - animation-direction: alternate; -} - -#pms-menu #btn_channel_manager_request .button-highlight { - color: white; - background-color: #FFA500; -} - -#pms-menu #btn_channel_manager_request .button-highlight i { - color: white; -} \ No newline at end of file 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 deleted file mode 100644 index 266291905..000000000 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_controller.js +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar_channel_connector.PMSHotelCalendarController', function (require) { -"use strict"; - -var PMSCalendarController = require('hotel_calendar.PMSCalendarController'); -var Core = require('web.core'); - -var QWeb = Core.qweb; - -var PMSHotelCalendarController = PMSCalendarController.include({ - _sounds: [], - SOUNDS: { NONE: 0, BOOK_NEW:1, BOOK_CANCELLED:2 }, - - init: function (parent, model, renderer, params) { - this._super.apply(this, arguments); - - this._sounds[this.SOUNDS.BOOK_NEW] = new Audio('hotel_calendar_channel_connector/static/sfx/book_new.mp3'); - this._sounds[this.SOUNDS.BOOK_CANCELLED] = new Audio('hotel_calendar_channel_connector/static/sfx/book_cancelled.mp3'); - }, - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - - //-------------------------------------------------------------------------- - // Private - //-------------------------------------------------------------------------- - _play_sound: function(/*int*/SoundID) { - this._sounds[SoundID].play(); - }, - - _generate_reservation_tooltip_dict: function(tp) { - var qdict = this._super(tp); - qdict['ota_name'] = tp['ota_name']; - qdict['ota_reservation_id'] = tp['ota_reservation_id']; - qdict['external_id'] = tp['external_id']; - return qdict; - }, - - //-------------------------------------------------------------------------- - // Handlers - //-------------------------------------------------------------------------- - _update_buttons_counter: function (ev) { - this._super(ev); - var self = this; - var domain_reservations = [['to_assign', '=', true]]; - // FIXME: invalid domain search. Issues are in hotel_channel_connector_issue; - // var domain_issues = [['to_assign', '=', true]]; - var domain_issues = []; - $.when( - this.model.search_count(domain_reservations), - this.model.search_count(domain_issues), - ).then(function(a1, a2){ - self.renderer.update_buttons_counter_channel_connector(a1, a2); - }); - }, - - _onBusNotification: function(notifications) { - for (var notif of notifications) { - if (notif[0][1] === 'hotel.reservation') { - if (notif[1]['type'] === 'issue') { - if (notif[1]['userid'] === this.dataset.context.uid) { - continue; - } - - var issue = notif[1]['issue']; - var qdict = issue; - var msg = QWeb.render('HotelCalendarChannelConnector.NotificationIssue', qdict); - if (notif[1]['subtype'] === 'notify') { - this.do_notify(notif[1]['title'], msg, true); - } else if (notif[1]['subtype'] === 'warn') { - this.do_warn(notif[1]['title'], msg, true); - } - } - else if (notif[1]['type'] === 'reservation') { - var reserv = notif[1]['reservation']; - if (reserv['channel_type'] == 'web') { - if (notif[1]['action'] === 'create') { - this._play_sound(this.SOUNDS.BOOK_NEW); - } else if (notif[1]['action'] !== 'unlink' && reserv['state'] === 'cancelled') { - this._play_sound(this.SOUNDS.BOOK_CANCELLED); - } - } - } - } - } - this._super(notifications); - }, - - _refresh_view_options: function(active_index) { - /* btn_channel_manager_request */ - this._super(active_index); - - }, - -}); - -return PMSHotelCalendarController; - -}); diff --git a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js deleted file mode 100644 index 89ed396e2..000000000 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_controller.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2019 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar_channel_connector.MPMSCalendarController', function (require) { -"use strict"; - -var MPMSCalendarController = require('hotel_calendar.MPMSCalendarController'); -var HotelConstants = require('hotel_calendar.Constants'); -var Core = require('web.core'); - -var QWeb = Core.qweb; - - -var MPMSCalendarController = MPMSCalendarController.include({ - - _onBusNotification: function (notifications) { - this._super.apply(this, arguments); - if (!this.renderer._hcalendar) { return; } - - for (var notif of notifications) { - if (notif[0][1] === 'hotel.reservation') { - switch (notif[1]['type']) { - case 'availability': - var avail = notif[1]['availability']; - var room_type = Object.keys(avail)[0]; - var day = Object.keys(avail[room_type])[0]; - var dt = HotelCalendarManagement.toMoment(day); - var availability = {}; - availability[room_type] = [{ - 'date': dt.format(HotelConstants.ODOO_DATE_MOMENT_FORMAT), - 'quota': avail[room_type][day]['quota'], - 'max_avail': avail[room_type][day]['max_avail'], - 'no_ota': avail[room_type][day]['no_ota'], - 'id': avail[room_type][day]['id'], - 'channel_avail': avail[room_type][day]['channel_avail'] - }]; - this.renderer._hcalendar.addAvailability(availability); - break; - } - } - } - }, - -}); - -return MPMSCalendarController; - -}); diff --git a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_renderer.js b/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_renderer.js deleted file mode 100644 index 494d629f5..000000000 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_management_renderer.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2019 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar_channel_connector.MPMSCalendarRenderer', function (require) { -"use strict"; - -var MPMSCalendarRenderer = require('hotel_calendar.MPMSCalendarRenderer'); -var Core = require('web.core'); - -var QWeb = Core.qweb; - - -var MPMSCalendarRenderer = MPMSCalendarRenderer.include({ - - /** CUSTOM METHODS **/ - get_values_to_save: function() { - var values = this._super.apply(this, arguments); - if (values) { - var availability = this._hcalendar.getAvailability(true); - values.push(availability); - } - return values; - }, - -}); - -return MPMSCalendarRenderer; - -}); 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 deleted file mode 100644 index 9c5c1b84d..000000000 --- a/hotel_calendar_channel_connector/static/src/js/views/hotel_calendar_renderer.js +++ /dev/null @@ -1,66 +0,0 @@ -/* global odoo, $ */ -// Copyright 2018 Alexandre Díaz -// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -odoo.define('hotel_calendar_channel_connector.PMSHotelCalendarRenderer', function (require) { - 'use strict'; - - var PMSCalendarRenderer = require('hotel_calendar.PMSCalendarRenderer'); - - var PMSHotelCalendarRenderer = PMSCalendarRenderer.include({ - - update_buttons_counter_channel_connector: function (nreservations, nissues) { - // Cloud Reservations - var $text = this.$el.find('#btn_channel_manager_request .cloud-text'); - $text.text(nreservations); - if (nreservations > 0) { - $text.parent().parent().addClass('button-highlight'); - $text.parent().addClass('incoming'); - } else { - $text.parent().parent().removeClass('button-highlight'); - $text.parent().removeClass('incoming'); - } - - // Issues - var $ninfo = this.$el.find('#pms-menu #btn_action_issues div.ninfo'); - $ninfo.text(nissues); - if (nissues) { - $ninfo.parent().parent().addClass('button-highlight'); - } else { - $ninfo.parent().parent().removeClass('button-highlight'); - } - }, - - init_calendar_view: function () { - var self = this; - return this._super().then(function () { - self.$el.find('#btn_channel_manager_request').on('click', function (ev) { - self.do_action("hotel_calendar_channel_connector.hotel_reservation_action_manager_request"); - }); - }); - }, - - _generate_search_domain: function(tsearch, type) { - var domain = this._super(tsearch, type); - - if (type === 'book') { - domain.splice(0, 0, '|'); - domain.push('|', - ['channel_bind_ids.external_id', 'ilike', tsearch], - ['channel_bind_ids.ota_reservation_id', 'ilike', tsearch]); - } - - return domain; - }, - - _generate_search_res_model: function(type) { - var [model, title] = this._super(type); - if (type === 'book') { - model = 'hotel.reservation'; - } - return [model, title]; - }, - - }); - - return PMSHotelCalendarRenderer; -}); diff --git a/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml b/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml deleted file mode 100644 index 9210f655e..000000000 --- a/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml +++ /dev/null @@ -1,25 +0,0 @@ - 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 deleted file mode 100644 index 53cc525aa..000000000 --- a/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - -
      - -
      -
      - -
      -
      -
      - - - - -
    • Channel:
    • -
      -
      -
      - -
      diff --git a/hotel_calendar_channel_connector/tests/__init__.py b/hotel_calendar_channel_connector/tests/__init__.py deleted file mode 100644 index 9920f3f1e..000000000 --- a/hotel_calendar_channel_connector/tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -#from . import test_folio diff --git a/hotel_calendar_channel_connector/tests/test_folio.py b/hotel_calendar_channel_connector/tests/test_folio.py deleted file mode 100644 index 824d9a05f..000000000 --- a/hotel_calendar_channel_connector/tests/test_folio.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from datetime import timedelta -from odoo.addons.hotel_calendar.tests.common import TestHotelCalendar -from odoo.addons.hotel import date_utils - - -class TestHotelReservations(TestHotelCalendar): - - def test_cancel_folio(self): - now_utc_dt = date_utils.now() diff --git a/hotel_calendar_channel_connector/views/actions.xml b/hotel_calendar_channel_connector/views/actions.xml deleted file mode 100644 index ee379e1f8..000000000 --- a/hotel_calendar_channel_connector/views/actions.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - Reservations to Assign from Channel - hotel.reservation - tree,form - - [('to_assign','=',True)] - - - - - - Channel Connector Issues - hotel.channel.connector.issue - tree,form - [('to_read','=',True)] - - - - diff --git a/hotel_calendar_channel_connector/views/general.xml b/hotel_calendar_channel_connector/views/general.xml deleted file mode 100644 index e221334b0..000000000 --- a/hotel_calendar_channel_connector/views/general.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/hotel_calendar_channel_connector/views/hotel_reservation.xml b/hotel_calendar_channel_connector/views/hotel_reservation.xml deleted file mode 100644 index 5c1d7aa76..000000000 --- a/hotel_calendar_channel_connector/views/hotel_reservation.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - hotel.toassign.reservation.tree - hotel.reservation - - - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - channel.backend.tree - channel.backend - - - - - - - - - - Hotel Channel Backends - channel.backend - tree,form - - - - diff --git a/hotel_channel_connector/views/channel_hotel_reservation_views.xml b/hotel_channel_connector/views/channel_hotel_reservation_views.xml deleted file mode 100644 index 10bed411d..000000000 --- a/hotel_channel_connector/views/channel_hotel_reservation_views.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - channel.hotel.reservation.form - channel.hotel.reservation - -
      - - - - - - - -
      -
      -
      - - - channel.hotel.reservation.tree - channel.hotel.reservation - - - - - - - -
      diff --git a/hotel_channel_connector/views/channel_hotel_room_type_availability_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_availability_views.xml deleted file mode 100644 index 1ded8cfed..000000000 --- a/hotel_channel_connector/views/channel_hotel_room_type_availability_views.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - channel.hotel.room.type.availability.form - channel.hotel.room.type.availability - -
      - - - - - - - - - - - - -
      -
      -
      - - - channel.hotel.room.type.availability.tree - channel.hotel.room.type.availability - - - - - - - - - -
      diff --git a/hotel_channel_connector/views/channel_hotel_room_type_restriction_item_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_restriction_item_views.xml deleted file mode 100644 index 697439ae8..000000000 --- a/hotel_channel_connector/views/channel_hotel_room_type_restriction_item_views.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - channel.hotel.room.type.restriction.item.form - channel.hotel.room.type.restriction.item - -
      - - - - - - - -
      -
      -
      - - - channel.hotel.room.type.restriction.item.tree - channel.hotel.room.type.restriction.item - - - - - - - -
      diff --git a/hotel_channel_connector/views/channel_hotel_room_type_restriction_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_restriction_views.xml deleted file mode 100644 index b468bce5e..000000000 --- a/hotel_channel_connector/views/channel_hotel_room_type_restriction_views.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - channel.hotel.room.type.restriction.form - channel.hotel.room.type.restriction - -
      - - - - - - - -
      -
      -
      - - - channel.hotel.room.type.restriction.tree - channel.hotel.room.type.restriction - - - - - - - - - Hotel Channel Connector Bindings - channel.hotel.room.type.restriction - tree,form - [] - - -
      diff --git a/hotel_channel_connector/views/channel_hotel_room_type_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_views.xml deleted file mode 100644 index af7fe19ac..000000000 --- a/hotel_channel_connector/views/channel_hotel_room_type_views.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - channel.hotel.room.type.form - channel.hotel.room.type - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -
      -
      - - - channel.hotel.room.type.tree - channel.hotel.room.type - - - - - - - - - Hotel Channel Connector Bindings - channel.hotel.room.type - tree,form - [] - -
      diff --git a/hotel_channel_connector/views/channel_ota_info_views.xml b/hotel_channel_connector/views/channel_ota_info_views.xml deleted file mode 100644 index b0afa0036..000000000 --- a/hotel_channel_connector/views/channel_ota_info_views.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - channel.ota.info.form - channel.ota.info - -
      - - - - - - - - - - -
      -
      -
      - - - - channel.ota.info.tree - channel.ota.info - - - - - - - - -
      diff --git a/hotel_channel_connector/views/channel_product_pricelist_item_views.xml b/hotel_channel_connector/views/channel_product_pricelist_item_views.xml deleted file mode 100644 index 65329ae92..000000000 --- a/hotel_channel_connector/views/channel_product_pricelist_item_views.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - channel.product.pricelist.item.form - channel.product.pricelist.item - -
      - - - - -
      -
      -
      - - - channel.hotel.product.pricelist.item.tree - channel.product.pricelist.item - - - - - - - -
      diff --git a/hotel_channel_connector/views/channel_product_pricelist_views.xml b/hotel_channel_connector/views/channel_product_pricelist_views.xml deleted file mode 100644 index b0ae78574..000000000 --- a/hotel_channel_connector/views/channel_product_pricelist_views.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - channel.product.pricelist.form - channel.product.pricelist - -
      - - - - - - - - - -
      -
      -
      - - - channel.hotel.product.pricelist.tree - channel.product.pricelist - - - - - - - - - Hotel Channel Connector Bindings - channel.product.pricelist - tree,form - [] - - -
      diff --git a/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml b/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml deleted file mode 100644 index 0ed44f164..000000000 --- a/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - hotel.channel.connector.issue.form - hotel.channel.connector.issue - -
      - -
      - -
      - - - - - - - - - - - - - - - -
      -
      -
      -
      - - - - hotel.channel.connector.issue.tree - hotel.channel.connector.issue - tree - - - - - - - - - - - - - - - - hotel.channel.connector.issue.search - hotel.channel.connector.issue - - - - - - - - - - - - - - - - Hotel Channel Connector Issues - hotel.channel.connector.issue - tree,form - - {"search_default_to_read":True} - - -
      diff --git a/hotel_channel_connector/views/hotel_room_type_availability_views.xml b/hotel_channel_connector/views/hotel_room_type_availability_views.xml deleted file mode 100644 index b7ac713cc..000000000 --- a/hotel_channel_connector/views/hotel_room_type_availability_views.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - hotel.room.type.availability.form - hotel.room.type.availability - -
      - - - -

      -
      - - - - - - - - - - - - - - - - -
      -
      - - -
      -
      -
      -
      - - - - hotel.room.type.availability.tree - hotel.room.type.availability - - - - - - - - - - - - - - Room Type Availability - hotel.room.type.availability - tree,form - - - - -
      diff --git a/hotel_channel_connector/views/inherited_hotel_folio_views.xml b/hotel_channel_connector/views/inherited_hotel_folio_views.xml deleted file mode 100644 index de8bb3a13..000000000 --- a/hotel_channel_connector/views/inherited_hotel_folio_views.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - hotel.folio - - - - - - - - - - - diff --git a/hotel_channel_connector/views/inherited_hotel_reservation_views.xml b/hotel_channel_connector/views/inherited_hotel_reservation_views.xml deleted file mode 100644 index 5a9c97e58..000000000 --- a/hotel_channel_connector/views/inherited_hotel_reservation_views.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - hotel.reservation - - - - - - - - - - - - - - - - - - - - - - - - - - - - {'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]} - - - {'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]} - - - {'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]} - - - {'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]} - - - {'readonly': [('is_from_ota','=',True),('able_to_modify_channel','=',False)]} - - - {'readonly': [('parent.is_from_ota','=',True),('parent.able_to_modify_channel','=',False)]} - True - - - - - - - - hotel.reservation - - - - - - - - - - - {'readonly': [('is_from_ota', '!=', False)]} - - - {'readonly': [('is_from_ota', '!=', False)]} - - - - - - - hotel.reservation - - - - - - - - - - - - - - - - view.hotel.reservation.graph - hotel.reservation - - - - - - - - - - - view.hotel.pivot.graph - hotel.reservation - - - - - - - - - - diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_item_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_restriction_item_views.xml deleted file mode 100644 index 45f134e40..000000000 --- a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_item_views.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - hotel.room.type.restriction.item - - - - - - - - - - - - - - - - - - - diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml deleted file mode 100644 index 730b622f3..000000000 --- a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - hotel.room.type.restriction - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - -
      - - - - - - - budget.tree (in hotel_data_bi) - budget - - - - - - - - - - - - diff --git a/hotel_data_bi/views/inherit_res_company.xml b/hotel_data_bi/views/inherit_res_company.xml deleted file mode 100644 index 7f610c7e0..000000000 --- a/hotel_data_bi/views/inherit_res_company.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - databi.config.view_company_form - res.company - - - - - - - - - - - - - - diff --git a/hotel_door_codes/README.rst b/hotel_door_codes/README.rst deleted file mode 100644 index 39b189275..000000000 --- a/hotel_door_codes/README.rst +++ /dev/null @@ -1,13 +0,0 @@ -DOOR CODES -========== - -Generate HOTEL DOOR CODES - - -Credits -======= - -Creator ------------- - -* Jose Luis Algara Toledo diff --git a/hotel_door_codes/__init__.py b/hotel_door_codes/__init__.py deleted file mode 100644 index d81805226..000000000 --- a/hotel_door_codes/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018-2019 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## -from . import models -from . import wizard diff --git a/hotel_door_codes/__manifest__.py b/hotel_door_codes/__manifest__.py deleted file mode 100644 index b08654307..000000000 --- a/hotel_door_codes/__manifest__.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Odoo, Open Source Management Solution -# Copyright (C) 2018-2019 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## - -{ - 'name': 'Hotel Door Codes', - 'version': '3.0', - 'author': "Jose Luis Algara Toledo ", - 'website': 'https://www.aldahotels.com', - 'category': 'hotel code', - 'summary': "Generate Hotel door codes, in Pseudo random system", - 'description': "Hotel Door Codes. Now multihotel", - 'depends': [ - 'hotel', - # 'hotel_l10n_es' - ], - 'data': [ - 'wizard/door_code.xml', - 'data/menus.xml', - 'views/inherit_hotel_property.xml', - 'views/inherit_hotel_reservation.xml', - # 'views/inherit_report_viajero.xml', - ], - 'qweb': [], - 'test': [ - ], - 'installable': True, - 'auto_install': False, - 'application': False, - 'license': 'AGPL-3', -} diff --git a/hotel_door_codes/data/menus.xml b/hotel_door_codes/data/menus.xml deleted file mode 100644 index ca4aa8714..000000000 --- a/hotel_door_codes/data/menus.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/hotel_door_codes/i18n/es.po b/hotel_door_codes/i18n/es.po deleted file mode 100644 index 2dc9270f6..000000000 --- a/hotel_door_codes/i18n/es.po +++ /dev/null @@ -1,162 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * hotel_door_codes -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-27 12:40+0000\n" -"PO-Revision-Date: 2019-11-27 17:33+0100\n" -"Last-Translator: Jose Luis Algara Toledo \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"Language: es\n" -"X-Generator: Poedit 2.0.6\n" - -#. module: hotel_door_codes -#: code:addons/hotel_door_codes/wizard/door_code.py:66 -#, python-format -msgid " to:" -msgstr " a:" - -#. module: hotel_door_codes -#: code:addons/hotel_door_codes/models/inherit_hotel_reservation.py:51 -#, python-format -msgid " to: " -msgstr " a: " - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_hotel_reservation_box_number -msgid "Box Number" -msgstr "Numero de caja" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_hotel_reservation_box_code -msgid "Box code" -msgstr "Código de caja" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_hotel_property_postcode -msgid "Characters after the code" -msgstr "Caracteres después del código" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_hotel_property_precode -msgid "Characters before the door code" -msgstr "Caracteres antes del código de la puerta" - -#. module: hotel_door_codes -#: model:ir.ui.menu,name:hotel_door_codes.menu_hotel_door_code -msgid "Check door codes" -msgstr "Ver códigos de puertas" - -#. module: hotel_door_codes -#: model:ir.model,name:hotel_door_codes.model_res_company -msgid "Companies" -msgstr "Empresas" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_create_uid -msgid "Created by" -msgstr "Creado por" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_create_date -msgid "Created on" -msgstr "Creado en" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_display_name -msgid "Display Name" -msgstr "Nombre para mostrar" - -#. module: hotel_door_codes -#: model:ir.actions.act_window,name:hotel_door_codes.door_code_act -#: model:ir.model,name:hotel_door_codes.model_door_code -#: model:ir.ui.view,arch_db:hotel_door_codes.hotel_door_code_view -msgid "Door Code Generator" -msgstr "Generador de códigos de puerta" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_hotel_reservation_door_codes -#: model:ir.ui.view,arch_db:hotel_door_codes.door_code_view_property_form -msgid "Door Codes" -msgstr "Códigos de puerta" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_door_code -msgid "Door code" -msgstr "Código de puerta" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_date_end -msgid "End of period" -msgstr "Fin del periodo" - -#. module: hotel_door_codes -#: code:addons/hotel_door_codes/models/inherit_hotel_reservation.py:42 -#: code:addons/hotel_door_codes/wizard/door_code.py:57 -#, python-format -msgid "Entry Code: " -msgstr "Código de entrada: " - -#. module: hotel_door_codes -#: model:ir.ui.view,arch_db:hotel_door_codes.door_code_reservation_form -msgid "Entry Codes" -msgstr "Códigos de entrada" - -#. module: hotel_door_codes -#: model:ir.ui.view,arch_db:hotel_door_codes.hotel_door_code_view -msgid "Generate Code" -msgstr "Generar códigos" - -#. module: hotel_door_codes -#: model:ir.model,name:hotel_door_codes.model_hotel_property -msgid "Hotel" -msgstr "Hotel" - -#. module: hotel_door_codes -#: model:ir.model,name:hotel_door_codes.model_hotel_reservation -msgid "Hotel Reservation" -msgstr "Hotel Reservation" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_id -msgid "ID" -msgstr "ID" - -#. module: hotel_door_codes -#: code:addons/hotel_door_codes/wizard/door_code.py:64 -#, python-format -msgid "It will change on " -msgstr "Cambiará el " - -#. module: hotel_door_codes -#: code:addons/hotel_door_codes/models/inherit_hotel_reservation.py:49 -#, python-format -msgid "It will change on Monday " -msgstr "Cambiará el lunes " - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code___last_update -msgid "Last Modified on" -msgstr "Última modificación el" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_write_uid -msgid "Last Updated by" -msgstr "Última actualización por" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_write_date -msgid "Last Updated on" -msgstr "Ultima actualización en" - -#. module: hotel_door_codes -#: model:ir.model.fields,field_description:hotel_door_codes.field_door_code_date_start -msgid "Start of the period" -msgstr "Comienzo del periodo" diff --git a/hotel_door_codes/models/__init__.py b/hotel_door_codes/models/__init__.py deleted file mode 100644 index 6ec88ba49..000000000 --- a/hotel_door_codes/models/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018-2019 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from . import inherit_hotel_property -from . import inherit_hotel_reservation diff --git a/hotel_door_codes/models/inherit_hotel_property.py b/hotel_door_codes/models/inherit_hotel_property.py deleted file mode 100644 index adad5943b..000000000 --- a/hotel_door_codes/models/inherit_hotel_property.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018-2019 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from openerp import models, fields - - -class InheritHotelProperty(models.Model): - _inherit = 'hotel.property' - - precode = fields.Char('Characters before the door code', default=' ') - postcode = fields.Char('Characters after the code', default=' ') diff --git a/hotel_door_codes/models/inherit_hotel_reservation.py b/hotel_door_codes/models/inherit_hotel_reservation.py deleted file mode 100644 index 1353a279c..000000000 --- a/hotel_door_codes/models/inherit_hotel_reservation.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018-2019 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from openerp import models, fields, api, _ -from datetime import datetime, timedelta -from openerp.tools import DEFAULT_SERVER_DATE_FORMAT - - -class Inherit_hotel_reservation(models.Model): - _inherit = 'hotel.reservation' - - # Default methods - - def _compute_door_codes(self): - for res in self: - entrada = datetime.strptime( - res.checkin[:10], DEFAULT_SERVER_DATE_FORMAT) - if datetime.weekday(entrada) == 0: - entrada = entrada + timedelta(days=1) - salida = datetime.strptime( - res.checkout[:10], DEFAULT_SERVER_DATE_FORMAT) - if datetime.weekday(salida) == 0: - salida = salida - timedelta(days=1) - codes = (_('Entry Code: ') + - '' + - res.doorcode4(datetime.strftime(entrada, "%Y-%m-%d")) + - '') - while entrada <= salida: - if datetime.weekday(entrada) == 0: - codes += ("
      " + - _('It will change on Monday ') + - datetime.strftime(entrada, "%d-%m-%Y") + - _(' to: ') + - '' + - res.doorcode4(datetime.strftime( - entrada, "%Y-%m-%d")) + - '') - entrada = entrada + timedelta(days=1) - res.door_codes = codes - - # Fields declaration - door_codes = fields.Html( - 'Door Codes', - compute='_compute_door_codes') - box_number = fields.Integer('Box Number') - box_code = fields.Char('Box code') - - - def doorcode4(self, fecha): - # Calculate de Door Code... need a date in String format "%Y-%m-%d" - compan = self.env.user.hotel_id - if not compan.precode: - compan.precode = " " - if not compan.postcode: - compan.postcode = " " - d = datetime.strptime(fecha, DEFAULT_SERVER_DATE_FORMAT) - dia_semana = datetime.weekday(d) # Dias a restar y ponerlo en lunes - d = d - timedelta(days=dia_semana) - dtxt = d.strftime('%s.%%06d') % d.microsecond - dtxt = compan.precode + dtxt[4:8] + compan.postcode - return dtxt diff --git a/hotel_door_codes/static/description/icon.png b/hotel_door_codes/static/description/icon.png deleted file mode 100644 index 0d7c99f06..000000000 Binary files a/hotel_door_codes/static/description/icon.png and /dev/null differ diff --git a/hotel_door_codes/views/inherit_hotel_property.xml b/hotel_door_codes/views/inherit_hotel_property.xml deleted file mode 100644 index 602a1c46e..000000000 --- a/hotel_door_codes/views/inherit_hotel_property.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - door_code.config.view_property_form - hotel.property - - - - - - - - - - - - diff --git a/hotel_door_codes/views/inherit_hotel_reservation.xml b/hotel_door_codes/views/inherit_hotel_reservation.xml deleted file mode 100644 index cc66dfea7..000000000 --- a/hotel_door_codes/views/inherit_hotel_reservation.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - door_code.reservation_form - hotel.reservation - - - - - - - - - - - - - - - diff --git a/hotel_door_codes/wizard/__init__.py b/hotel_door_codes/wizard/__init__.py deleted file mode 100644 index 180966b56..000000000 --- a/hotel_door_codes/wizard/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018-2019 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## -from . import door_code diff --git a/hotel_door_codes/wizard/door_code.py b/hotel_door_codes/wizard/door_code.py deleted file mode 100644 index 2a4a8416c..000000000 --- a/hotel_door_codes/wizard/door_code.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Odoo, Open Source Management Solution -# Copyright (C) 2018-2019 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## -from datetime import datetime, timedelta -from odoo import api, fields, models, _ -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT - - -class DoorCodeWizard(models.TransientModel): - _name = 'door_code' - _description = 'Door Code Generator' - - # Default methods - - def _get_default_date_start(self): - return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT) - - # Fields declaration - date_start = fields.Date( - "Start of the period", - default=_get_default_date_start) - date_end = fields.Date( - "End of period", - default=_get_default_date_start) - door_code = fields.Html("Door code") - - - def check_code(self): - reservation = self.env['hotel.reservation'] - - entrada = datetime.strptime( - self.date_start, DEFAULT_SERVER_DATE_FORMAT) - if datetime.weekday(entrada) == 0: - entrada = entrada + timedelta(days=1) - salida = datetime.strptime( - self.date_end, DEFAULT_SERVER_DATE_FORMAT) - if datetime.weekday(salida) == 0: - salida = salida - timedelta(days=1) - codes = (_('Entry Code: ') + - '' + - reservation.doorcode4(self.date_start) + - '') - while entrada <= salida: - if datetime.weekday(entrada) == 0: - codes += ("
      " + - _('It will change on ') + - datetime.strftime(entrada, "%d-%m-%Y") + - _(' to:') + - '' + - reservation.doorcode4(datetime.strftime( - entrada, "%Y-%m-%d")) + - '') - entrada = entrada + timedelta(days=1) - - return self.write({ - 'door_code': codes, - 'name': 'Ya te digo', - 'clear_breadcrumb': True, - 'target': 'current', - }) diff --git a/hotel_door_codes/wizard/door_code.xml b/hotel_door_codes/wizard/door_code.xml deleted file mode 100644 index ea1fc061c..000000000 --- a/hotel_door_codes/wizard/door_code.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Door codes - door_code - -
      - - - - - - - - - - -
      -
      -
      -
      -
      -
      - -
      -
      diff --git a/hotel_ine/__init__.py b/hotel_ine/__init__.py deleted file mode 100644 index c6369ae7d..000000000 --- a/hotel_ine/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2019 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from . import wizard -from . import models diff --git a/hotel_ine/__manifest__.py b/hotel_ine/__manifest__.py deleted file mode 100644 index 00247262e..000000000 --- a/hotel_ine/__manifest__.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Odoo, Open Source Management Solution -# Copyright (C) 2019 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## -{ - 'name': 'Hotel Ine', - 'description': """ - Create de INE Report""", - 'version': '1.0.0', - 'license': 'AGPL-3', - 'summary': "Export hotel data for INE report", - 'author': "Jose Luis Algara (Alda hotels) ", - 'website': 'www.aldahotels.com', - 'depends': ['hotel', 'hotel_l10n_es'], - 'category': 'hotel/ine', - 'data': [ - 'wizard/inewizard.xml', - 'views/inherited_hotel_room_view.xml', - ], - 'demo': [ - ], - 'installable': True, - 'auto_install': False, - 'application': False, -} diff --git a/hotel_ine/models/__init__.py b/hotel_ine/models/__init__.py deleted file mode 100644 index c96e3b034..000000000 --- a/hotel_ine/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import inherited_hotel_room diff --git a/hotel_ine/models/inherited_hotel_room.py b/hotel_ine/models/inherited_hotel_room.py deleted file mode 100644 index cbd11348a..000000000 --- a/hotel_ine/models/inherited_hotel_room.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright 2019 Jose Luis Algara -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields - - -class HotelRoom(models.Model): - _inherit = 'hotel.room' - - in_ine = fields.Boolean('Included in the INE statistics', default=True) diff --git a/hotel_ine/static/description/icon.png b/hotel_ine/static/description/icon.png deleted file mode 100755 index c066d3473..000000000 Binary files a/hotel_ine/static/description/icon.png and /dev/null differ diff --git a/hotel_ine/views/inherited_hotel_room_view.xml b/hotel_ine/views/inherited_hotel_room_view.xml deleted file mode 100644 index 7f0a2ba51..000000000 --- a/hotel_ine/views/inherited_hotel_room_view.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - hotel.room - - - - - - - - - - - - - diff --git a/hotel_ine/wizard/__init__.py b/hotel_ine/wizard/__init__.py deleted file mode 100644 index 53a5cd324..000000000 --- a/hotel_ine/wizard/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2019 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - -from . import inewizard diff --git a/hotel_ine/wizard/inewizard.py b/hotel_ine/wizard/inewizard.py deleted file mode 100644 index 56bd0962b..000000000 --- a/hotel_ine/wizard/inewizard.py +++ /dev/null @@ -1,321 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017-19 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - -from openerp import models, fields, api -import base64 -import datetime -import calendar -import xml.etree.cElementTree as ET -from odoo.exceptions import UserError -import logging -_logger = logging.getLogger(__name__) - - -def get_years(): - year_list = [] - for i in range(2017, get_year()+1): - year_list.append((i, str(i))) - return year_list - - -def get_year(): - now = datetime.datetime.now() - return int(now.year) - - -def get_month(): - now = datetime.datetime.now() - month = int(now.month)-1 - if month <= 0: - month = 12 - return month - - -class Wizard(models.TransientModel): - _name = 'ine.wizard' - - txt_filename = fields.Char() - txt_binary = fields.Binary() - - ine_month = fields.Selection([(1, 'January'), (2, 'February'), - (3, 'March'), (4, 'April'), - (5, 'May'), (6, 'June'), (7, 'July'), - (8, 'August'), (9, 'September'), - (10, 'October'), (11, 'November'), - (12, 'December'), ], - string='Month', default=get_month()) - ine_year = fields.Selection(get_years(), default=get_year(), string='Year') - - adr_screen = fields.Char() - rev_screen = fields.Char() - - def generate_file(self): - _logger.warning("Start Export INE XML file") - last_day = calendar.monthrange(self.ine_year, self.ine_month)[1] - ine_start_search = datetime.date(self.ine_year, self.ine_month, 1) - ine_end_search = ine_start_search + datetime.timedelta(days=last_day) - compan = self.env.user.company_id - active_room = self.env['hotel.room'].search([('in_ine', '=', True)]) - message = "" - if not compan.property_name: - message = 'The NAME of the property is not established' - if not compan.name: - message = 'The NAME of the company is not established' - if not compan.vat: - message = 'The VAT is not established' - if not compan.ine_tourism: - message = 'The tourism number of the property is not established' - if message != "": - raise UserError(message) - return - encuesta = ET.Element("ENCUESTA") - cabezera = ET.SubElement(encuesta, "CABECERA") - fecha = ET.SubElement(cabezera, "FECHA_REFERENCIA") - ET.SubElement(fecha, "MES").text = "%02d" % (self.ine_month) - ET.SubElement(fecha, "ANYO").text = str(self.ine_year) - ET.SubElement(cabezera, "DIAS_ABIERTO_MES_REFERENCIA").text = ( - str(last_day)) - ET.SubElement(cabezera, "RAZON_SOCIAL").text = compan.name - ET.SubElement(cabezera, "NOMBRE_ESTABLECIMIENTO").text = ( - compan.property_name) - ET.SubElement(cabezera, "CIF_NIF").text = compan.vat[2:].strip() - ET.SubElement(cabezera, "NUMERO_REGISTRO").text = compan.ine_tourism - ET.SubElement(cabezera, "DIRECCION").text = compan.street - ET.SubElement(cabezera, "CODIGO_POSTAL").text = compan.zip - ET.SubElement(cabezera, "LOCALIDAD").text = compan.city - ET.SubElement(cabezera, "MUNICIPIO").text = compan.city - ET.SubElement(cabezera, "PROVINCIA" - ).text = compan.state_id.display_name - ET.SubElement(cabezera, "TELEFONO_1").text = ( - compan.phone.replace(' ', '')[0:12]) - ET.SubElement(cabezera, "TIPO").text = ( - compan.ine_category_id.category_type) - ET.SubElement(cabezera, "CATEGORIA").text = compan.ine_category_id.name - - ET.SubElement(cabezera, "HABITACIONES").text = str(len(active_room)) - ET.SubElement(cabezera, "PLAZAS_DISPONIBLES_SIN_SUPLETORIAS" - ).text = str(compan.ine_seats) - ET.SubElement(cabezera, "URL").text = compan.website - alojamiento = ET.SubElement(encuesta, "ALOJAMIENTO") - - all_room_nights = self.env['hotel.reservation.line'].search([ - ('date', '>=', ine_start_search), - ('date', '<', ine_end_search), - ('reservation_id.room_id.in_ine', '=', True), - ('reservation_id.state', '!=', "cancelled"), - ('reservation_id.reservation_type', '=', 'normal'), - ]) - room_nights = all_room_nights.filtered( - lambda n: (self.get_codeine(n.reservation_id))) - - # Creating the empty dictionary system - dic_tabla = [] - for room_night in room_nights: - ine_code = self.get_codeine(room_night.reservation_id) - if not next((item for item in dic_tabla if item["ine"] == ine_code), False): - for x in range(1, last_day+1): - dic_tabla.append({'ine': ine_code, - 'dia': x, - 'entradas': 0, - 'salidas': 0, - 'pernocta': 0 - }) - - # Adding overnight stays per day and INE code - pernocta_total = [] - for dia in range(1, last_day+1): - pernocta_total.append(0) - for room_night in room_nights.filtered( - lambda x: x.date == str(self.ine_year)+'-'+str( - self.ine_month).zfill(2)+'-'+str(dia).zfill(2)): - ine_code = self.get_codeine(room_night.reservation_id) - for idx, val in enumerate(dic_tabla): - if val['ine'] == ine_code and val['dia'] == dia: - dic_tabla[idx]['pernocta'] += room_night.reservation_id.adults - - # Calculating outputs and entries - last_stay = 0 - for idx, row in enumerate(dic_tabla): - if dic_tabla[idx]['dia'] == 1: - last_stay = 0 - - if last_stay < dic_tabla[idx]['pernocta']: - dic_tabla[idx]['entradas'] += dic_tabla[idx]['pernocta'] - last_stay - elif last_stay > dic_tabla[idx]['pernocta']: - dic_tabla[idx]['salidas'] += last_stay - dic_tabla[idx][ - 'pernocta'] - # _logger.warning("%s: %s Perenocta: %s In: %s Out: %s Last=%s", dic_tabla[idx]['ine'], dic_tabla[idx]['dia'], dic_tabla[idx]['pernocta'], dic_tabla[idx]['entradas'], dic_tabla[idx]['salidas'],last_stay) - last_stay = dic_tabla[idx]['pernocta'] - pernocta_total[(dic_tabla[idx]['dia'])-1] += dic_tabla[idx]['pernocta'] - - # "Print" outputs and entries - ine_residen = "" - for idx, row in enumerate(dic_tabla): - if ine_residen != dic_tabla[idx]['ine']: - ine_residen = dic_tabla[idx]['ine'] - residencia = ET.SubElement(alojamiento, "RESIDENCIA") - if len(dic_tabla[idx]['ine']) > 3: - ET.SubElement(residencia, "ID_PROVINCIA_ISLA" - ).text = str(dic_tabla[idx]['ine']) - else: - ET.SubElement(residencia, "ID_PAIS" - ).text = str(dic_tabla[idx]['ine']) - if ((dic_tabla[idx]['entradas'] != 0) - or (dic_tabla[idx]['salidas'] != 0) - or (dic_tabla[idx]['pernocta'] != 0)): - movimiento = ET.SubElement(residencia, "MOVIMIENTO") - ET.SubElement(movimiento, "N_DIA").text = ( - "%02d" % dic_tabla[idx]['dia']) - ET.SubElement(movimiento, "ENTRADAS").text = str( - dic_tabla[idx]['entradas']) - ET.SubElement(movimiento, "SALIDAS").text = str( - dic_tabla[idx]['salidas']) - ET.SubElement(movimiento, "PERNOCTACIONES").text = str( - dic_tabla[idx]['pernocta']) - - habitaciones = ET.SubElement(encuesta, "HABITACIONES") - # Bucle de HABITACIONES_MOVIMIENTO - - ingresos = 0 - habitaci = 0 - hab_vend = 0 - for dia in range(1, last_day+1): - suple = 0 - doble = 0 - dindi = 0 - otras = 0 - - habitaci += len(active_room) - habitaci -= self.env['hotel.reservation.line'].search([ - ('date', '=', str(self.ine_year)+'-'+str( - self.ine_month).zfill(2)+'-'+str(dia).zfill(2)), - ('reservation_id.reservation_type', '!=', 'normal'), - ], count=True) - for room_night in room_nights.filtered(lambda x: x.date == str( - self.ine_year)+'-'+str( - self.ine_month).zfill(2)+'-'+str( - dia).zfill(2)): - ingresos += room_night.price - hab_vend += 1 - - if room_night.reservation_id.room_id.capacity == 2: - if room_night.reservation_id.adults == 1: - dindi += 1 - else: - doble += 1 - else: - otras += 1 - if len(room_night.reservation_id.service_ids): - for service in room_night.reservation_id.service_ids: - if service.product_id.is_extra_bed: - suple += 1 - - # Here, we correct the extra beds - if pernocta_total[dia-1] > suple + compan.ine_seats: - suple = pernocta_total[dia-1] - compan.ine_seats - - habitaciones_m = ET.SubElement(habitaciones, - "HABITACIONES_MOVIMIENTO") - ET.SubElement(habitaciones_m, - "HABITACIONES_N_DIA").text = "%02d" % (dia) - ET.SubElement(habitaciones_m, - "PLAZAS_SUPLETORIAS").text = str(suple) - ET.SubElement(habitaciones_m, - "HABITACIONES_DOBLES_USO_DOBLE").text = str(doble) - ET.SubElement(habitaciones_m, - "HABITACIONES_DOBLES_USO_INDIVIDUAL").text = str( - dindi) - ET.SubElement(habitaciones_m, - "HABITACIONES_OTRAS").text = str(otras) - - precios = ET.SubElement(encuesta, "PRECIOS") - ET.SubElement(precios, - "REVPAR_MENSUAL").text = str(round(ingresos/habitaci, 2)) - ET.SubElement(precios, - "ADR_MENSUAL").text = str(round(ingresos/hab_vend, 2)) - ET.SubElement(precios, "ADR_TOUROPERADOR_TRADICIONAL").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_TOUROPERADOR_TRADICIONAL" - ).text = '0' - ET.SubElement(precios, - "ADR_TOUROPERADOR_ONLINE").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_TOUROPERADOR_ONLINE" - ).text = '0' - ET.SubElement(precios, - "ADR_EMPRESAS").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_EMPRESAS").text = '0' - ET.SubElement(precios, - "ADR_AGENCIA_DE_VIAJE_TRADICIONAL").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_AGENCIA_TRADICIONAL" - ).text = '0' - ET.SubElement(precios, "ADR_AGENCIA_DE_VIAJE_ONLINE").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_AGENCIA_ONLINE" - ).text = '0' - ET.SubElement(precios, "ADR_PARTICULARES").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_PARTICULARES").text = '0' - ET.SubElement(precios, - "ADR_GRUPOS").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_GRUPOS").text = '0' - ET.SubElement(precios, "ADR_INTERNET").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_INTERNET").text = '0' - ET.SubElement(precios, "ADR_OTROS").text = '0' - ET.SubElement(precios, - "PCTN_HABITACIONES_OCUPADAS_OTROS").text = '0' - - personal = ET.SubElement(encuesta, "PERSONAL_OCUPADO") - ET.SubElement(personal, "PERSONAL_NO_REMUNERADO").text = '0' - ET.SubElement(personal, - "PERSONAL_REMUNERADO_FIJO").text = str( - compan.ine_permanent_staff) - ET.SubElement(personal, - "PERSONAL_REMUNERADO_EVENTUAL").text = str( - compan.ine_eventual_staff) - - xmlstr = '' - xmlstr += ET.tostring(encuesta).decode('utf-8') - return self.write({ - 'txt_filename': 'INE_'+str(self.ine_month)+'_'+str( - self.ine_year) + '.' + 'xml', - 'adr_screen': 'ADR en el mes de la encuesta: '+str( - round(ingresos/habitaci, 2)) + '€ y ', - 'rev_screen': ' RevPar : '+str(round(ingresos/hab_vend, 2))+'€', - 'txt_binary': base64.encodestring(xmlstr.encode()) - }) - - @api.model - def get_codeine(self, reserva): - response = False - code = reserva[0].partner_id.code_ine_id - if code: - response = code.code - else: - for l in reserva[0].folio_id.checkin_partner_ids: - if l.code_ine_id: - response = l.code_ine_id.code - return response diff --git a/hotel_ine/wizard/inewizard.xml b/hotel_ine/wizard/inewizard.xml deleted file mode 100644 index 02a326938..000000000 --- a/hotel_ine/wizard/inewizard.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - INE File Download - ine.wizard - -
      - - - - - -
      -
      - - -
      - - -
      -
      - -
      -

      Abrir web del I.N.E.: Presentar encuesta I.N.E.

      -
      -
      -
      -
      -
      -
      - - - -
      - -
      diff --git a/hotel_l10n_es/README.rst b/hotel_l10n_es/README.rst deleted file mode 100755 index bb1595313..000000000 --- a/hotel_l10n_es/README.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 - -Alda Hotels PMS-Checkin -============= -Checkin for Alda Hostels - - -Use -=== -Instal in Odoo and checkin - -Remember to complete the "hotel settings" configuration fields in the company file. - -Credits -======= - -Creator ------------- - -* Jose Luis Algara -* Darío Lodeiros diff --git a/hotel_l10n_es/__init__.py b/hotel_l10n_es/__init__.py deleted file mode 100755 index 18db0383d..000000000 --- a/hotel_l10n_es/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - -from . import models -from . import wizard diff --git a/hotel_l10n_es/__manifest__.py b/hotel_l10n_es/__manifest__.py deleted file mode 100755 index 5b9c8e978..000000000 --- a/hotel_l10n_es/__manifest__.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - - -{ - 'name': 'Hotel l10n_es', - 'version': '9.0.0.3', - 'author': "Jose Luis Algara", - 'website': "http://www.aldahotels.com", - 'category': 'Hotel', - 'summary': "", - 'description': "", - 'depends': [ - 'hotel', - 'partner_contact_gender', - 'partner_contact_birthdate', - 'partner_firstname', - 'partner_vat_unique', - ], - 'data': [ - 'data/code.ine.csv', - 'data/tourism.category.csv', - 'data/report_viajero_paperformat.xml', - 'report/report_parte_viajero.xml', - 'views/report_viajero.xml', - 'wizard/police_wizard.xml', - 'views/category_tourism.xml', - 'views/code_ine.xml', - 'views/inherit_res_company.xml', - 'views/inherit_hotel_checkin_partner_views.xml', - 'security/ir.model.access.csv', - 'views/inherit_res_partner.xml', - 'views/inherited_hotel_reservation_views.xml', - 'views/report_viajero_document.xml', - 'views/report_viajero_head.xml', - 'views/report_viajero_data.xml', - 'views/report_viajero.xml', - 'views/hotel_l10n_es_hotel_name.xml' - ], - 'test': [ - ], - 'css': ['static/src/css/hotel_l10n_es.css'], - 'installable': True, - 'auto_install': False, - 'application': False, - 'license': 'AGPL-3', -} diff --git a/hotel_l10n_es/data/code.ine.csv b/hotel_l10n_es/data/code.ine.csv deleted file mode 100755 index 29f4a84a2..000000000 --- a/hotel_l10n_es/data/code.ine.csv +++ /dev/null @@ -1,309 +0,0 @@ -"id","code","name" -"__export__.code_ine_1","AFG","Afganistán" -"__export__.code_ine_2","ALB","Albania" -"__export__.code_ine_3","DEU","Alemania" -"__export__.code_ine_4","AND","Andorra" -"__export__.code_ine_5","AGO","Angola" -"__export__.code_ine_6","AIA","Anguila" -"__export__.code_ine_7","ATG","Antigua y Barbuda" -"__export__.code_ine_8","ANT","Antillas Neerlandesas" -"__export__.code_ine_9","ATA","Antártida" -"__export__.code_ine_10","SAU","Arabia Saudita" -"__export__.code_ine_11","DZA","Argelia" -"__export__.code_ine_12","ARG","Argentina" -"__export__.code_ine_13","ARM","Armenia" -"__export__.code_ine_14","ABW","Aruba" -"__export__.code_ine_15","AUS","Australia" -"__export__.code_ine_16","AUT","Austria" -"__export__.code_ine_17","AZE","Azerbaiyán" -"__export__.code_ine_18","BHS","Bahamas" -"__export__.code_ine_19","BHR","Bahrein" -"__export__.code_ine_20","BGD","Bangladesh" -"__export__.code_ine_21","BRB","Barbados" -"__export__.code_ine_22","BLZ","Belice" -"__export__.code_ine_23","BEN","Benin" -"__export__.code_ine_24","BMU","Bermudas" -"__export__.code_ine_25","BTN","Bhután" -"__export__.code_ine_26","BLR","Bielorrusia" -"__export__.code_ine_27","BOL","Bolivia" -"__export__.code_ine_28","BIH","Bosnia-Herzegovina" -"__export__.code_ine_29","BWA","Botswana" -"__export__.code_ine_30","BRA","Brasil" -"__export__.code_ine_31","BRN","Brunéi" -"__export__.code_ine_32","BGR","Bulgaria" -"__export__.code_ine_33","BFA","Burkina Fasso" -"__export__.code_ine_34","BDI","Burundi" -"__export__.code_ine_35","BEL","Bélgica" -"__export__.code_ine_36","CPV","Cabo Verde" -"__export__.code_ine_37","KHM","Camboya" -"__export__.code_ine_38","CMR","Camerún" -"__export__.code_ine_39","CAN","Canadá" -"__export__.code_ine_40","TCD","Chad" -"__export__.code_ine_41","CHL","Chile" -"__export__.code_ine_42","CHN","China" -"__export__.code_ine_43","CYP","Chipre" -"__export__.code_ine_44","COL","Colombia" -"__export__.code_ine_45","COM","Comoras" -"__export__.code_ine_46","COG","Congo, República del" -"__export__.code_ine_47","COD","Congo, República Democrática del" -"__export__.code_ine_48","PRK","Corea, Rep. Popular Democrática" -"__export__.code_ine_49","KOR","Corea, República de" -"__export__.code_ine_50","CIV","Costa de Marfil" -"__export__.code_ine_51","CRI","Costa Rica" -"__export__.code_ine_52","HRV","Croacia" -"__export__.code_ine_53","CUB","Cuba" -"__export__.code_ine_54","DNK","Dinamarca" -"__export__.code_ine_55","DMA","Dominica" -"__export__.code_ine_56","ECU","Ecuador" -"__export__.code_ine_57","EGY","Egipto" -"__export__.code_ine_58","SLV","El Salvador" -"__export__.code_ine_59","ARE","Emiratos Arabes Unidos" -"__export__.code_ine_60","ERI","Eritrea" -"__export__.code_ine_61","SVK","Eslovaquia" -"__export__.code_ine_62","SVN","Eslovenia" -"__export__.code_ine_63","USA","Estados Unidos de América" -"__export__.code_ine_64","EST","Estonia" -"__export__.code_ine_65","ETH","Etiopía" -"__export__.code_ine_66","PHL","Filipinas" -"__export__.code_ine_67","FIN","Finlandia" -"__export__.code_ine_68","FRA","Francia" -"__export__.code_ine_69","GAB","Gabón" -"__export__.code_ine_70","GMB","Gambia" -"__export__.code_ine_71","GEO","Georgia" -"__export__.code_ine_72","GHA","Ghana" -"__export__.code_ine_73","GIB","Gibraltar" -"__export__.code_ine_74","GRD","Granada" -"__export__.code_ine_75","GRC","Grecia" -"__export__.code_ine_76","GRL","Groenlandia" -"__export__.code_ine_77","GLP","Guadalupe" -"__export__.code_ine_78","GUM","Guam" -"__export__.code_ine_79","GTM","Guatemala" -"__export__.code_ine_80","GUF","Guayana Francesa" -"__export__.code_ine_81","GIN","Guinea" -"__export__.code_ine_82","GNQ","Guinea Ecuatorial" -"__export__.code_ine_83","GNB","Guinea-Bissau" -"__export__.code_ine_84","GUY","Guyana" -"__export__.code_ine_85","HTI","Haití" -"__export__.code_ine_86","HND","Honduras" -"__export__.code_ine_87","HKG","Hong-Kong" -"__export__.code_ine_88","HUN","Hungría" -"__export__.code_ine_89","IND","India" -"__export__.code_ine_90","IDN","Indonesia" -"__export__.code_ine_91","IRQ","Irak" -"__export__.code_ine_92","IRL","Irlanda" -"__export__.code_ine_93","IRN","Irán" -"__export__.code_ine_94","BVT","Isla Bouvert" -"__export__.code_ine_95","GGY","Isla de Guernesey" -"__export__.code_ine_96","JEY","Isla de Jersey" -"__export__.code_ine_97","IMN","Isla de Man" -"__export__.code_ine_98","CXR","Isla de Navidad" -"__export__.code_ine_99","ISL","Islandia" -"__export__.code_ine_100","CYM","Islas Caimán" -"__export__.code_ine_101","CCK","Islas Cocos" -"__export__.code_ine_102","COK","Islas Cook" -"__export__.code_ine_103","FLK","Islas Falkland (Malvinas)" -"__export__.code_ine_104","FRO","Islas Feroé" -"__export__.code_ine_105","FJI","Islas Fidji" -"__export__.code_ine_106","SGS","Islas Georgias del Sur y Sandwich" -"__export__.code_ine_107","HMD","Islas Heard e Mcdonald" -"__export__.code_ine_108","MNP","Islas Marianas del Norte" -"__export__.code_ine_109","MHL","Islas Marshall" -"__export__.code_ine_110","UMI","Islas Menores de EEUU" -"__export__.code_ine_111","NFK","Islas Norfolk" -"__export__.code_ine_112","PCN","Islas Pitcairn" -"__export__.code_ine_113","SLB","Islas Salomón" -"__export__.code_ine_114","TCA","Islas Turcas y Caicos" -"__export__.code_ine_115","VGB","Islas Vírgenes Británicas" -"__export__.code_ine_116","VIR","Islas Vírgenes de los EEUU" -"__export__.code_ine_117","WLF","Islas Wallis y Futura" -"__export__.code_ine_118","ALA","Islas Åland" -"__export__.code_ine_119","ISR","Israel" -"__export__.code_ine_120","ITA","Italia" -"__export__.code_ine_121","JAM","Jamaica" -"__export__.code_ine_122","JPN","Japón" -"__export__.code_ine_123","JOR","Jordania" -"__export__.code_ine_124","KAZ","Kazajstán" -"__export__.code_ine_125","KEN","Kenia" -"__export__.code_ine_126","KGZ","Kirguistán" -"__export__.code_ine_127","KIR","Kiribati" -"__export__.code_ine_128","KWT","Kuwait" -"__export__.code_ine_129","LAO","Laos" -"__export__.code_ine_130","LSO","Lesotho" -"__export__.code_ine_131","LVA","Letonia" -"__export__.code_ine_132","LBY","Libia" -"__export__.code_ine_133","LBR","Libéria" -"__export__.code_ine_134","LIE","Liechtenstein" -"__export__.code_ine_135","LTU","Lituania" -"__export__.code_ine_136","LUX","Luxemburgo" -"__export__.code_ine_137","LBN","Líbano" -"__export__.code_ine_138","MAC","Macao" -"__export__.code_ine_139","MKD","Macedonia, ARY" -"__export__.code_ine_140","MDG","Madagascar" -"__export__.code_ine_141","MYS","Malasia" -"__export__.code_ine_142","MWI","Malawi" -"__export__.code_ine_143","MDV","Maldivas" -"__export__.code_ine_144","MLT","Malta" -"__export__.code_ine_145","MLI","Malí" -"__export__.code_ine_146","MAR","Marruecos" -"__export__.code_ine_147","MTQ","Martinica" -"__export__.code_ine_148","MUS","Mauricio" -"__export__.code_ine_149","MRT","Mauritania" -"__export__.code_ine_150","MYT","Mayotte" -"__export__.code_ine_151","FSM","Micronesia" -"__export__.code_ine_152","MDA","Moldavia" -"__export__.code_ine_153","MNG","Mongolia" -"__export__.code_ine_154","MNE","Montenegro" -"__export__.code_ine_155","MSR","Montserrat" -"__export__.code_ine_156","MOZ","Mozambique" -"__export__.code_ine_157","MMR","Myanmar" -"__export__.code_ine_158","MEX","México" -"__export__.code_ine_159","MCO","Mónaco" -"__export__.code_ine_160","NAM","Namibia" -"__export__.code_ine_161","NRU","Naurú" -"__export__.code_ine_162","NPL","Nepal" -"__export__.code_ine_163","NIC","Nicaragua" -"__export__.code_ine_164","NGA","Nigeria" -"__export__.code_ine_165","NIU","Niue" -"__export__.code_ine_166","NOR","Noruega" -"__export__.code_ine_167","NCL","Nueva Caledonia" -"__export__.code_ine_168","NZL","Nueva Zelanda" -"__export__.code_ine_169","NER","Níger" -"__export__.code_ine_170","OMN","Omán" -"__export__.code_ine_171","PAK","Pakistán" -"__export__.code_ine_172","PLW","Palau" -"__export__.code_ine_173","PSE","Palestina, Territorio ocupado" -"__export__.code_ine_174","PAN","Panamá" -"__export__.code_ine_175","PNG","Papua Nueva Guinea" -"__export__.code_ine_176","PRY","Paraguay" -"__export__.code_ine_177","NLD","Países Bajos" -"__export__.code_ine_178","PER","Perú" -"__export__.code_ine_179","PYF","Polinesia Francesa" -"__export__.code_ine_180","POL","Polonia" -"__export__.code_ine_181","PRT","Portugal" -"__export__.code_ine_182","PRI","Puerto Rico" -"__export__.code_ine_183","QAT","Qatar" -"__export__.code_ine_184","GBR","Reino Unido" -"__export__.code_ine_185","CAF","República Centroafricana" -"__export__.code_ine_186","CZE","República Checa" -"__export__.code_ine_187","DOM","República Dominicana" -"__export__.code_ine_188","REU","Reunión" -"__export__.code_ine_189","ROU","Rumania" -"__export__.code_ine_190","RUS","Rusia" -"__export__.code_ine_191","RWA","Rwanda" -"__export__.code_ine_192","ESH","Sahara Occidental" -"__export__.code_ine_193","KNA","Saint Kitts y Nevis" -"__export__.code_ine_194","WSM","Samoa" -"__export__.code_ine_195","ASM","Samoa Americana" -"__export__.code_ine_196","BLM","San Bartolomé" -"__export__.code_ine_197","SMR","San Marino" -"__export__.code_ine_198","MAF","San Martín" -"__export__.code_ine_199","SPM","San Pedro y Miquelón" -"__export__.code_ine_200","VCT","San Vicente y las Granadinas" -"__export__.code_ine_201","SHN","Santa Elena" -"__export__.code_ine_202","LCA","Santa Lucía" -"__export__.code_ine_203","STP","Santo Tomé y Príncipe" -"__export__.code_ine_204","SEN","Senegal" -"__export__.code_ine_205","SRB","Serbia" -"__export__.code_ine_206","SYC","Seychelles" -"__export__.code_ine_207","SLE","Sierra Leona" -"__export__.code_ine_208","SGP","Singapur" -"__export__.code_ine_209","SYR","Siria" -"__export__.code_ine_210","SOM","Somalia" -"__export__.code_ine_211","LKA","Sri Lanka" -"__export__.code_ine_212","SWZ","Suazilandia" -"__export__.code_ine_213","ZAF","Sudáfrica" -"__export__.code_ine_214","SDN","Sudán" -"__export__.code_ine_215","SWE","Suecia" -"__export__.code_ine_216","CHE","Suiza" -"__export__.code_ine_217","SUR","Suriname" -"__export__.code_ine_218","SJM","Svalbard e Islas de Jan Mayen" -"__export__.code_ine_219","THA","Tailandia" -"__export__.code_ine_220","TWN","Taiwán" -"__export__.code_ine_221","TZA","Tanzania" -"__export__.code_ine_222","TJK","Tayikistan" -"__export__.code_ine_223","IOT","Terr. Británico del Oc. Indico" -"__export__.code_ine_224","ATF","Tierras Australes Francesas" -"__export__.code_ine_225","TLS","Timor Oriental" -"__export__.code_ine_226","TGO","Togo" -"__export__.code_ine_227","TKL","Tokelau" -"__export__.code_ine_228","TON","Tonga" -"__export__.code_ine_229","TTO","Trinidad y Tobago" -"__export__.code_ine_230","TKM","Turkmenistán" -"__export__.code_ine_231","TUR","Turquía" -"__export__.code_ine_232","TUV","Tuvalu" -"__export__.code_ine_233","TUN","Túnez" -"__export__.code_ine_234","UKR","Ucrania" -"__export__.code_ine_235","UGA","Uganda" -"__export__.code_ine_236","URY","Uruguay" -"__export__.code_ine_237","UZB","Uzbekistán" -"__export__.code_ine_238","VUT","Vanuatu" -"__export__.code_ine_239","VAT","Vaticano, Santa Sede" -"__export__.code_ine_240","VEN","Venezuela" -"__export__.code_ine_241","VNM","Vietnam" -"__export__.code_ine_242","YEM","Yemen" -"__export__.code_ine_243","DJI","Yibuti" -"__export__.code_ine_244","ZMB","Zambia" -"__export__.code_ine_245","ZWE","Zimbabwe" -"__export__.code_ine_246","KOS","Kosovo" -"__export__.code_ine_247","ES111","A Coruña" -"__export__.code_ine_248","ES112","Lugo" -"__export__.code_ine_249","ES113","Ourense" -"__export__.code_ine_250","ES114","Pontevedra" -"__export__.code_ine_251","ES120","Asturias" -"__export__.code_ine_252","ES130","Cantabria" -"__export__.code_ine_253","ES211","Araba/Álava" -"__export__.code_ine_254","ES212","Gipuzkoa" -"__export__.code_ine_255","ES213","Bizkaia" -"__export__.code_ine_256","ES220","Navarra" -"__export__.code_ine_257","ES230","La Rioja" -"__export__.code_ine_258","ES241","Huesca" -"__export__.code_ine_259","ES242","Teruel" -"__export__.code_ine_260","ES243","Zaragoza" -"__export__.code_ine_261","ES300","Madrid" -"__export__.code_ine_262","ES411","Ávila" -"__export__.code_ine_263","ES412","Burgos" -"__export__.code_ine_264","ES413","León" -"__export__.code_ine_265","ES414","Palencia" -"__export__.code_ine_266","ES415","Salamanca" -"__export__.code_ine_267","ES416","Segovia" -"__export__.code_ine_268","ES417","Soria" -"__export__.code_ine_269","ES418","Valladolid" -"__export__.code_ine_270","ES419","Zamora" -"__export__.code_ine_271","ES421","Albacete" -"__export__.code_ine_272","ES422","Ciudad Real" -"__export__.code_ine_273","ES423","Cuenca" -"__export__.code_ine_274","ES424","Guadalajara" -"__export__.code_ine_275","ES425","Toledo" -"__export__.code_ine_276","ES431","Badajoz" -"__export__.code_ine_277","ES432","Cáceres" -"__export__.code_ine_278","ES511","Barcelona" -"__export__.code_ine_279","ES512","Girona" -"__export__.code_ine_280","ES513","Lleida" -"__export__.code_ine_281","ES514","Tarragona" -"__export__.code_ine_282","ES521","Alicante / Alacant" -"__export__.code_ine_283","ES522","Castellón / Castelló" -"__export__.code_ine_284","ES523","Valencia / València" -"__export__.code_ine_285","ES530","Illes Balears" -"__export__.code_ine_286","ES531","Eivissa y Formentera" -"__export__.code_ine_287","ES532","Mallorca" -"__export__.code_ine_288","ES533","Menorca" -"__export__.code_ine_289","ES611","Almería" -"__export__.code_ine_290","ES612","Cádiz" -"__export__.code_ine_291","ES613","Córdoba" -"__export__.code_ine_292","ES614","Granada" -"__export__.code_ine_293","ES615","Huelva" -"__export__.code_ine_294","ES616","Jaén" -"__export__.code_ine_295","ES617","Málaga" -"__export__.code_ine_296","ES618","Sevilla" -"__export__.code_ine_297","ES620","Murcia" -"__export__.code_ine_298","ES630","Ceuta" -"__export__.code_ine_299","ES640","Melilla" -"__export__.code_ine_300","ES701","Las Palmas" -"__export__.code_ine_301","ES702","Santa Cruz de Tenerife" -"__export__.code_ine_302","ES703","El Hierro" -"__export__.code_ine_303","ES704","Fuerteventura" -"__export__.code_ine_304","ES705","Gran Canaria" -"__export__.code_ine_305","ES706","La Gomera" -"__export__.code_ine_306","ES707","La Palma" -"__export__.code_ine_307","ES708","Lanzarote" -"__export__.code_ine_308","ES709","Tenerife" diff --git a/hotel_l10n_es/data/report_viajero_paperformat.xml b/hotel_l10n_es/data/report_viajero_paperformat.xml deleted file mode 100755 index 3d1cfb282..000000000 --- a/hotel_l10n_es/data/report_viajero_paperformat.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Parte de Viajero - - custom - 200 - 75 - Portrait - 1 - 3 - 0 - 0 - - 1 - 201 - - - - diff --git a/hotel_l10n_es/data/tourism.category.csv b/hotel_l10n_es/data/tourism.category.csv deleted file mode 100755 index f91ca57d3..000000000 --- a/hotel_l10n_es/data/tourism.category.csv +++ /dev/null @@ -1,54 +0,0 @@ -"id","name","category_type" -"__export__.category_1","H1","Hoteles" -"__export__.category_2","H2","Hoteles" -"__export__.category_3","H3","Hoteles" -"__export__.category_4","H4","Hoteles" -"__export__.category_5","H5","Hoteles" -"__export__.category_6","AP","Hoteles-apartamentos" -"__export__.category_7","HA","Hoteles-apartamentos" -"__export__.category_8","HA1","Hoteles-apartamentos" -"__export__.category_9","HA2","Hoteles-apartamentos" -"__export__.category_10","HA3","Hoteles-apartamentos" -"__export__.category_11","HA4","Hoteles-apartamentos" -"__export__.category_12","HA5","Hoteles-apartamentos" -"__export__.category_13","HR","Hoteles-residencias" -"__export__.category_14","HR1","Hoteles-residencias" -"__export__.category_15","HR2","Hoteles-residencias" -"__export__.category_16","HR3","Hoteles-residencias" -"__export__.category_17","HR4","Hoteles-residencias" -"__export__.category_18","HR5","Hoteles-residencias" -"__export__.category_19","M1","Moteles" -"__export__.category_20","M2","Moteles" -"__export__.category_21","M3","Moteles" -"__export__.category_22","PN3","Paradores Nacionales" -"__export__.category_23","PN4","Paradores Nacionales" -"__export__.category_24","PN5","Paradores Nacionales" -"__export__.category_25","CV1","Ciudades de vacaciones" -"__export__.category_26","CV2","Ciudades de vacaciones" -"__export__.category_27","CV3","Ciudades de vacaciones" -"__export__.category_28","RA1","Residencias-apartamentos" -"__export__.category_29","RA2","Residencias-apartamentos" -"__export__.category_30","RA3","Residencias-apartamentos" -"__export__.category_31","RA4","Residencias-apartamentos" -"__export__.category_32","HS","Hostales" -"__export__.category_33","HS1","Hostales" -"__export__.category_34","HS2","Hostales" -"__export__.category_35","HS3","Hostales" -"__export__.category_36","HSR","Hostales" -"__export__.category_37","HSR1","Hostales" -"__export__.category_38","HSR2","Hostales" -"__export__.category_39","HSR3","Hostales" -"__export__.category_40","HSE","Hostales generales" -"__export__.category_41","HSG","Hostales especiales" -"__export__.category_42","CH","Casas de Huéspedes" -"__export__.category_43","CH1","Casas de Huéspedes" -"__export__.category_44","F1","Fondas" -"__export__.category_45","F2","Fondas" -"__export__.category_46","F3","Fondas" -"__export__.category_47","P","Pensiones" -"__export__.category_48","P1","Pensiones" -"__export__.category_49","P2","Pensiones" -"__export__.category_50","P3","Pensiones" -"__export__.category_51","PA","Pensiones" -"__export__.category_52","PT","Pensiones" -"__export__.category_53","Otras","Otros" diff --git a/hotel_l10n_es/i18n/es.po b/hotel_l10n_es/i18n/es.po deleted file mode 100755 index 85a97a2f3..000000000 --- a/hotel_l10n_es/i18n/es.po +++ /dev/null @@ -1,812 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * hotel_l10n_es -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-04-28 21:46+0000\n" -"PO-Revision-Date: 2019-04-28 23:52+0200\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"Language: es\n" -"X-Generator: Poedit 1.8.7.1\n" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/police_wizard.py:113 -#, python-format -msgid " records added from " -msgstr "registros añadidos desde" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/police_wizard.py:114 -#, python-format -msgid " records processed." -msgstr "registros procesados." - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_document -msgid ", at" -msgstr ", a" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_year:0 -msgid "2017" -msgstr "2017" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_year:0 -msgid "2018" -msgstr "2018" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_year:0 -msgid "2019" -msgstr "2019" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_document -msgid "COPY TO THE USER" -msgstr "COPIA PARA EL USUARIO" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/ine_wizard.py:432 -#, python-format -msgid "ADR in the month of the survey: " -msgstr "ADR en el mes de la solicitud:" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.ine_wizard_form -msgid "ADR y RevPar" -msgstr "ADR y RevPar" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_police_download -msgid "Abrir web de la Guardia Civil para entregar el fichero generado:" -msgstr "Abrir web de la Guardia Civil para entregar el fichero generado:" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_police_download -msgid "Abrir web de la Polícia para entregar el fichero generado:" -msgstr "Abrir web de la Polícia para entregar el fichero generado:" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.ine_wizard_form -msgid "Abrir web del I.N.E.:" -msgstr "Abrir web del I.N.E.:" - -#. module: hotel_l10n_es -#: model:ir.actions.act_window,name:hotel_l10n_es.action_ine_download -msgid "Action INE File Download" -msgstr "Descargar archivo INE" - -#. module: hotel_l10n_es -#: model:ir.actions.act_window,name:hotel_l10n_es.action_police_download -msgid "Action Police File Download" -msgstr "Descargar archivo policía" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_adr_screen -msgid "Adr Screen" -msgstr "Adr Screen" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "April" -msgstr "Abril" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "August" -msgstr "Agosto" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_ine_seats -msgid "Beds available" -msgstr "Camas disponibles" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_birthdate_date -msgid "Birhdate" -msgstr "Fecha de Nacimiento" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_reservation_view_tree -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_view_tree -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Birthdate" -msgstr "F. de nacimiento" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_head -msgid "CIF:" -msgstr "CIF:" - -#. module: hotel_l10n_es -#: selection:res.partner,document_type:0 -msgid "Carta o Doc. de Identidad" -msgstr "Carta o Doc. de Identidad" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_name -msgid "Category" -msgstr "Categoría" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_category_type -msgid "Category type" -msgstr "Tipo de Categoría" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_code -msgid "Code" -msgstr "Código" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_code_ine_id -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_partner_code_ine_id -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_users_code_ine_id -msgid "Code Ine" -msgstr "Code Ine" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_partner_form -msgid "Code in INE" -msgstr "Código en INE" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_res_company -msgid "Companies" -msgstr "Compañías" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_res_partner -msgid "Contact" -msgstr "Contacto" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_download_num -msgid "Correlative number" -msgstr "Núm Correlativo" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_res_partner.py:51 -#: model:ir.model.fields,help:hotel_l10n_es.field_hotel_checkin_partner_code_ine_id -#: model:ir.model.fields,help:hotel_l10n_es.field_res_partner_code_ine_id -#: model:ir.model.fields,help:hotel_l10n_es.field_res_users_code_ine_id -#, python-format -msgid "Country or province of origin. Used for INE statistics." -msgstr "País o provincia de origen. Usado para estadísticas INE." - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_police_download -msgid "Create Police File" -msgstr "Archivo de Policía Creado" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_create_uid -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_create_uid -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_create_uid -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_create_uid -msgid "Created by" -msgstr "Creado por" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_create_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_create_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_create_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_create_date -msgid "Created on" -msgstr "Creado en" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_partner_form -msgid "Customer Link" -msgstr "Enlace Cliente" - -#. module: hotel_l10n_es -#: selection:res.partner,document_type:0 -msgid "DNI" -msgstr "DNI" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_download_date -msgid "Date" -msgstr "Fecha" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "December" -msgstr "Diciembre" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_display_name -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_display_name -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_display_name -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_display_name -msgid "Display Name" -msgstr "Nombre mostrado" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_reservation_view_tree -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_view_tree -msgid "Doc. Number" -msgstr "Núm. de Documento" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_document_type -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_partner_document_type -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_users_document_type -msgid "Doc. type" -msgstr "Tipo de Documento" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_document_expedition_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_partner_document_expedition_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_users_document_expedition_date -msgid "Document expedition date" -msgstr "Fecha de Expedición" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_document_number -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_partner_document_number -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_users_document_number -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Document number" -msgstr "Nº de documento:" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_head -msgid "Document number:" -msgstr "Nº de documento:" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/ine_wizard.py:142 -#, python-format -msgid "ERROR: Usuario sin codigo de INE: " -msgstr "ERROR: Usuario sin codigo de INE: " - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_document -msgid "" -"En nombre de la empresa\n" -" GRUPO ALDA HOTELS\n" -" compuesto por Alda Rías Baixas SL, Alda Compostela SL, Alda Castilla SL, Hoteles Rías Altas SL, Comphostel Gestión Patrimonial SL y Consultores Hoteleros Integrales SL, tratamos la información que nos facilita, con el fin de prestarle el servicio\n" -" solicitado y realizar la facturación del mismo. Se conservarán mientras se mantenga la relación comercial o durante los años necesarios para cumplir con las obligaciones legales. No se cederán a terceros salvo en los casos en que exista una\n" -" obligación legal. Usted tiene derecho a obtener información sobre el tratamiento de sus datos personales, acceder, rectificar los inexactos o solicitar su supresión cuando ya no sean necesarios, en la dirección\n" -" protecciondatos@aldahotels.com\n" -" Asimismo hemos solicitado que confirme esta autorización para ofrecerle nuestros servicios y poder fidelizarle como cliente." -msgstr "" -"En nombre de la empresa\n" -" GRUPO ALDA HOTELS\n" -" compuesto por Alda Rías Baixas SL, Alda Compostela SL, Alda Castilla SL, Hoteles Rías Altas SL, Comphostel Gestión Patrimonial SL y Consultores Hoteleros Integrales SL, tratamos la información que nos facilita, con el fin de prestarle el servicio\n" -" solicitado y realizar la facturación del mismo. Se conservarán mientras se mantenga la relación comercial o durante los años necesarios para cumplir con las obligaciones legales. No se cederán a terceros salvo en los casos en que exista una\n" -" obligación legal. Usted tiene derecho a obtener información sobre el tratamiento de sus datos personales, acceder, rectificar los inexactos o solicitar su supresión cuando ya no sean necesarios, en la dirección\n" -" protecciondatos@aldahotels.com\n" -" Asimismo hemos solicitado que confirme esta autorización para ofrecerle nuestros servicios y poder fidelizarle como cliente." - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_document -msgid "" -"En nombre de la empresa\n" -" GRUPO ALDA HOTELS\n" -" compuesto por Alda Rías Baixas SL, Alda Compostela SL, Alda Castilla SL, Hoteles Rías Altas SL, Comphostel Gestión Patrimonial SL y Consultores Hoteleros Integrales SL, tratamos la información que nos facilita, con el fin de prestarle el servicio\n" -" solicitado y realizar la facturación del mismo. Se conservarán mientras se mantenga la relación comercial o durante los años necesarios para cumplir con las obligaciones legales. No se cederán a terceros salvo en los casos en que exista una\n" -" obligación legal. Usted tiene derecho a obtener información sobre el tratamiento de sus datos personales, acceder, rectificar los inexactos o solicitar su supresión cuando ya no sean necesarios, en la dirección\n" -" protecciondatos@aldahotels.com\n" -" Asimismo solicito confirme esta autorización para ofrecerle nuestros servicios y poder fidelizarle como cliente.
      Si ___ No ___" -msgstr "" -"En nombre de la empresa\n" -" GRUPO ALDA HOTELS\n" -" compuesto por Alda Rías Baixas SL, Alda Compostela SL, Alda Castilla SL, Hoteles Rías Altas SL, Comphostel Gestión Patrimonial SL y Consultores Hoteleros Integrales SL, tratamos la información que nos facilita, con el fin de prestarle el servicio\n" -" solicitado y realizar la facturación del mismo. Se conservarán mientras se mantenga la relación comercial o durante los años necesarios para cumplir con las obligaciones legales. No se cederán a terceros salvo en los casos en que exista una\n" -" obligación legal. Usted tiene derecho a obtener información sobre el tratamiento de sus datos personales, acceder, rectificar los inexactos o solicitar su supresión cuando ya no sean necesarios, en la dirección\n" -" protecciondatos@aldahotels.com\n" -" Asimismo solicito confirme esta autorización para ofrecerle nuestros servicios y poder fidelizarle como cliente.
      Si ___ No ___" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Entry date" -msgstr "Fecha de entrada" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_error_partner -msgid "Error Partner" -msgstr "Error Cliente" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_ine_eventual_staff -msgid "Eventual Staff" -msgstr "Staff eventual" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Exit date" -msgstr "Fecha Salida" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_reservation_view_tree -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_view_tree -msgid "Exp. Date" -msgstr "Fecha de Expedición" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Expedition date" -msgstr "Fecha expedición" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "February" -msgstr "Febrero" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/police_wizard.py:123 -#, python-format -msgid "File not generated by configuration error." -msgstr "Archivo no generado por errores de configuración." - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_firstname -msgid "First name" -msgstr "Nombre" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_res_partner.py:235 -#, python-format -msgid "For safety reasons, you cannot merge more than 3 contacts together. You can re-open the wizard several times if needed." -msgstr "Por razones de seguridad no se pudo fusionar a los contactos" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_gender -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Gender" -msgstr "Género" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.ine_wizard_form -msgid "Generar estadistica para el I.N.E." -msgstr "Generar estadistica para el I.N.E." - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_police_download -msgid "Generate Police file" -msgstr "Generar fichero para la Policía" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.ine_wizard_form -msgid "Generate file" -msgstr "Archivo creado!" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/police_wizard.py:118 -#, python-format -msgid "Generated file. Download it and give it to the police." -msgstr "Archivo creado!. Descargalo para entregarlo a la Policía." - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_police_download -msgid "Guardia Civil " -msgstr "Guardia Civil " - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_hotel_reservation -msgid "Hotel Reservation" -msgstr "Reserva del hotel" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_company_form -msgid "Hotel Settings" -msgstr "Configuración del Hotel" - -#. module: hotel_l10n_es -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_ine_category_id -msgid "Hotel category in the Ministry of Tourism. Used for INE statistics." -msgstr "Categoría del Hotel en el Ministerio de Turismo. Usado para las estadísticas del INE." - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_id -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_id -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_id -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_id -msgid "ID" -msgstr "ID (identificación)" - -#. module: hotel_l10n_es -#: model:ir.ui.menu,name:hotel_l10n_es.menu_ine_download -msgid "INE File Download" -msgstr "Descargar Archivo INE" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_company_form -msgid "INE and Police data" -msgstr "INE y Datos Policía" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_checkin_img -msgid "Image in checkin" -msgstr "Imagen en Checkin" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_hotel_checkin_partner.py:102 -#, python-format -msgid "Incorrect DNI" -msgstr "DNI Incorrecto" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_ine_category_id -msgid "Ine Category" -msgstr "Categoría Ine" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "January" -msgstr "Enero" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "July" -msgstr "Julio" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "June" -msgstr "Junio" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine___last_update -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard___last_update -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard___last_update -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category___last_update -msgid "Last Modified on" -msgstr "Última modificación en" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_write_uid -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_write_uid -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_write_uid -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_write_uid -msgid "Last Updated by" -msgstr "Última actualización de" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_write_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_write_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_write_date -#: model:ir.model.fields,field_description:hotel_l10n_es.field_tourism_category_write_date -msgid "Last Updated on" -msgstr "Última actualización en" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_lastname -msgid "Last name" -msgstr "Apellido" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_log_police -msgid "Log Police" -msgstr "Log Policía" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "March" -msgstr "Marzo" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "May" -msgstr "Mayo" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_res_partner.py:259 -#, python-format -msgid "Merged with the following partners:" -msgstr "Fusionado con los siguientes contactos:" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_ine_month -msgid "Month" -msgstr "Mes" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_hotel_checkin_partner_name -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Name" -msgstr "Nombre" - -#. module: hotel_l10n_es -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_property_name -msgid "Name of the Hotel/Property." -msgstr "Nombre del Hotel/Propiedad." - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/ine_wizard.py:440 -#, python-format -msgid "No data in this month" -msgstr "No hay información este mes" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "November" -msgstr "Noviembre" - -#. module: hotel_l10n_es -#: model:ir.model.fields,help:hotel_l10n_es.field_police_wizard_download_num -msgid "Number provided by the police" -msgstr "Núm. provisto por la policía" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "October" -msgstr "Octubre" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Origin" -msgstr "Origen" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_head -msgid "PART OF TRAVELERS ENTRY" -msgstr "PARTE DE ENTRADA DE VIAJEROS" - -#. module: hotel_l10n_es -#: model:ir.actions.report,name:hotel_l10n_es.action_report_viajero -msgid "Parte de Viajero" -msgstr "Parte de Viajero" - -#. module: hotel_l10n_es -#: selection:res.partner,document_type:0 -msgid "Pasaporte" -msgstr "Pasaporte" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_ine_permanent_staff -msgid "Permanent Staff" -msgstr "Permanent Staff" - -#. module: hotel_l10n_es -#: selection:res.partner,document_type:0 -msgid "Permiso Residencia Español" -msgstr "Permiso Residencia Español" - -#. module: hotel_l10n_es -#: selection:res.partner,document_type:0 -msgid "Permiso Residencia Europeo" -msgstr "Permiso Residencia Europeo" - -#. module: hotel_l10n_es -#: selection:res.partner,document_type:0 -msgid "Permiso de Conducir" -msgstr "Permiso de Conducir" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_code_ine_name -msgid "Place" -msgstr "Sitio" - -#. module: hotel_l10n_es -#: model:ir.ui.menu,name:hotel_l10n_es.menu_police_download -msgid "Police File Download" -msgstr "Desacargar Archivo Policía" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_police_number -msgid "Police number" -msgstr "Número Policía" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_police_download -msgid "Policia " -msgstr "Policia " - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.ine_wizard_form -msgid "Presentar encuesta I.N.E. " -msgstr "Presentar encuesta I.N.E. " - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_reservation_view_form -msgid "Print All Checkins" -msgstr "Imprimir todos los Checkins" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_view_form -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_view_tree -msgid "Print in PDF" -msgstr "Imprimir en PDF" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/police_wizard.py:110 -#, python-format -msgid "Problem generating the file. Checkin without data, or incorrect data: " -msgstr "Problema generando el archivo. Checkin sin datos, o con datos incorrectos: " - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_property_name -msgid "Property name" -msgstr "Nombre propiedad" - -#. module: hotel_l10n_es -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_ine_tourism -msgid "Registration number in the Ministry of Tourism. Used for INE statistics." -msgstr "Núm. de Registro en el Ministerio de Turismo. Usado en las estadísticas del INE." - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_rev_screen -msgid "Rev Screen" -msgstr "Rev Screen" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_ine_rooms -msgid "Rooms Available" -msgstr "Habitaciones Disponibles" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.hotel_checkin_partner_reservation_view_tree -msgid "Search" -msgstr "Búsqueda" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_res_partner.py:44 -#: model:ir.model.fields,help:hotel_l10n_es.field_hotel_checkin_partner_document_type -#: model:ir.model.fields,help:hotel_l10n_es.field_res_partner_document_type -#: model:ir.model.fields,help:hotel_l10n_es.field_res_users_document_type -#, python-format -msgid "Select a valid document type" -msgstr "Seleccione un tipo de documento válido" - -#. module: hotel_l10n_es -#: selection:ine.wizard,ine_month:0 -msgid "September" -msgstr "Septiembre" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Surnames" -msgstr "Apellidos" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_head -msgid "TRAVELER'S DOCUMENT" -msgstr "DOCUMENTO DEL VIAJERO" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_res_partner.py:186 -#, python-format -msgid "The Document Number %s already exists in another partner." -msgstr "El número de Documento %s ya existe en otro contacto confirmado." - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.view_partner_form -msgid "This partner was deactivated and merged with another client to avoid duplicity, you can see the active client in" -msgstr "Este cliente fue desactivado y fusionado con otro cliente para evitar duplicados, puedes ver el cliente activo en" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_hotel_checkin_partner.py:125 -#, python-format -msgid "To perform the checkin the following data are missing: %s" -msgstr "Para realizar el checkin faltan los siguientes datos: %s" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_hotel_checkin_partner.py:129 -#, python-format -msgid "To perform the checkin the segmentation is required" -msgstr "Para realizar el checkin es olbigatoria la segmentación de la reserva" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_head -msgid "Total amount (Reservation Card):" -msgstr "Importe total (Ficha de Reserva):" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_res_company_ine_tourism -msgid "Tourism number" -msgstr "Núm. de Turismo" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_document -msgid "Traveler's signature" -msgstr "Firma del viajero" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_txt_binary -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_txt_binary -msgid "Txt Binary" -msgstr "Txt Binary" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_txt_filename -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_txt_filename -msgid "Txt Filename" -msgstr "Txt Nombre de archivo" - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_police_wizard_txt_message -msgid "Txt Message" -msgstr "Txt Mensaje" - -#. module: hotel_l10n_es -#: model:ir.ui.view,arch_db:hotel_l10n_es.report_viajero_data -msgid "Type" -msgstr "Tipo" - -#. module: hotel_l10n_es -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_ine_eventual_staff -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_ine_permanent_staff -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_ine_rooms -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_ine_seats -msgid "Used for INE statistics." -msgstr "Usado en las estadísticas del INE." - -#. module: hotel_l10n_es -#: model:ir.model.fields,help:hotel_l10n_es.field_res_company_police_number -msgid "Used to generate the name of the file that will be given to the police. 10 Caracters" -msgstr "Usado para general el nombre del archivo que será entregado a la policía. 10 Caracteres." - -#. module: hotel_l10n_es -#: model:ir.model.fields,field_description:hotel_l10n_es.field_ine_wizard_ine_year -msgid "Year" -msgstr "Año" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/models/inherit_res_partner.py:242 -#, python-format -msgid "You cannot merge a contact with one of his parent." -msgstr "No se puede fusionar un contacto con su empresa relacionada." - -#. module: hotel_l10n_es -#: model:ir.actions.act_window,name:hotel_l10n_es.action_code_ine -msgid "action.code.ine" -msgstr "action.code.ine" - -#. module: hotel_l10n_es -#: model:ir.actions.act_window,name:hotel_l10n_es.action_tourism_category -msgid "action.tourism.category" -msgstr "Categorías de Turismo" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_code_ine -msgid "code.ine" -msgstr "code.ine" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_hotel_checkin_partner -msgid "hotel.checkin.partner" -msgstr "Checkins" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_ine_wizard -msgid "ine.wizard" -msgstr "ine.wizard" - -#. module: hotel_l10n_es -#: model:ir.ui.menu,name:hotel_l10n_es.menu_code_ine -msgid "menu.code.ine" -msgstr "menu.code.ine" - -#. module: hotel_l10n_es -#: model:ir.ui.menu,name:hotel_l10n_es.menu_tourism_category -msgid "menu.tourism.category" -msgstr "Categorías de Turismo" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_police_wizard -msgid "police.wizard" -msgstr "police.wizard" - -#. module: hotel_l10n_es -#: model:ir.model,name:hotel_l10n_es.model_tourism_category -msgid "tourism.category" -msgstr "Categoría de Turismo" - -#. module: hotel_l10n_es -#: code:addons/hotel_l10n_es/wizard/ine_wizard.py:433 -#, python-format -msgid "€ and " -msgstr "€ y" diff --git a/hotel_l10n_es/models/__init__.py b/hotel_l10n_es/models/__init__.py deleted file mode 100755 index 9a800ac78..000000000 --- a/hotel_l10n_es/models/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - -from . import category_type -from . import code_ine -from . import inherit_res_company -from . import inherit_res_partner -from . import inherit_hotel_checkin_partner -from . import inherit_hotel_reservation diff --git a/hotel_l10n_es/models/category_type.py b/hotel_l10n_es/models/category_type.py deleted file mode 100755 index 9f59cfbe3..000000000 --- a/hotel_l10n_es/models/category_type.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from odoo import models, fields, api - - -class TourismCategory(models.Model): - _name = 'tourism.category' - - name = fields.Char('Category', required=True) - category_type = fields.Char('Category type', required=True) - - - def name_get(self): - data = [] - for record in self: - display_value = record.category_type + " (" + record.name + ") " - data.append((record.id, display_value)) - return data diff --git a/hotel_l10n_es/models/code_ine.py b/hotel_l10n_es/models/code_ine.py deleted file mode 100755 index 7d00be2d4..000000000 --- a/hotel_l10n_es/models/code_ine.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - -from openerp import models, fields, api - - -class CodeIne(models.Model): - _name = 'code.ine' - - name = fields.Char('Place', required=True) - code = fields.Char('Code', required=True) - - - def name_get(self): - data = [] - for record in self: - subcode = record.code - if len(record.code) > 3: - subcode = 'ESP' - display_value = record.name + " (" + subcode + ")" - data.append((record.id, display_value)) - return data diff --git a/hotel_l10n_es/models/inherit_hotel_checkin_partner.py b/hotel_l10n_es/models/inherit_hotel_checkin_partner.py deleted file mode 100755 index f8cb4cfb5..000000000 --- a/hotel_l10n_es/models/inherit_hotel_checkin_partner.py +++ /dev/null @@ -1,127 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from openerp import models, fields, api, _ -from odoo.exceptions import UserError -import logging -_logger = logging.getLogger(__name__) - - -class HotelCheckinPartner(models.Model): - _inherit = 'hotel.checkin.partner' - - document_type = fields.Selection(related='partner_id.document_type') - document_number = fields.Char(related='partner_id.document_number') - document_expedition_date = fields.Date( - related='partner_id.document_expedition_date') - gender = fields.Selection('Gender', related='partner_id.gender') - birthdate_date = fields.Date('Birhdate', - related='partner_id.birthdate_date') - code_ine_id = fields.Many2one(related="partner_id.code_ine_id") - name = fields.Char(related='partner_id.name') - lastname = fields.Char(related='partner_id.lastname') - firstname = fields.Char(related='partner_id.firstname') - - @api.model - def create(self, vals): - if not vals.get('partner_id'): - name = self.env['res.partner']._get_computed_name( - vals.get('lastname'), - vals.get('firstname') - ) - partner = self.env['res.partner'].create({ - 'name': name, - }) - vals.update({'partner_id': partner.id}) - vals.pop('firstname') - vals.pop('lastname') - return super(HotelCheckinPartner, self).create(vals) - - - def write(self, vals): - for record in self: - if not vals.get('partner_id') and not record.partner_id: - name = self.env['res.partner']._get_computed_name( - vals.get('lastname'), - vals.get('firstname') - ) - partner = self.env['res.partner'].create({ - 'name': name, - }) - record.update({'partner_id': partner.id}) - vals.pop('firstname') - vals.pop('lastname') - return super(HotelCheckinPartner, self).write(vals) - - - def action_on_board(self): - self.check_required_fields() - return super(HotelCheckinPartner, self).action_on_board() - - @api.model - def check_dni(self, dni): - digits = "TRWAGMYFPDXBNJZSQVHLCKE" - dig_ext = "XYZ" - reemp_dig_ext = {'X': '0', 'Y': '1', 'Z': '2'} - numbers = "1234567890" - dni = dni.upper() - if len(dni) == 9: - dig_control = dni[8] - dni = dni[:8] - if dni[0] in dig_ext: - dni = dni.replace(dni[0], reemp_dig_ext[dni[0]]) - return len(dni) == len([n for n in dni if n in numbers]) \ - and digits[int(dni) % 23] == dig_control - else: - return False - - @api.onchange('document_number', 'document_type') - def onchange_document_number(self): - for record in self: - if record.document_type == 'D' and record.document_number: - if not record.check_dni(record.document_number): - record.document_number = False - raise UserError(_('Incorrect DNI')) - if not record.partner_id and record.document_number: - partner = self.env['res.partner'].search([ - ('document_number', '=', record.document_number) - ], limit=1) - if partner: - record.update({'partner_id': partner}) - - - def check_required_fields(self): - for record in self: - missing_fields = [] - required_fields = ['document_type', 'document_number', - 'document_expedition_date', 'gender', - 'birthdate_date', 'code_ine_id', - 'lastname', 'firstname'] - for field in required_fields: - if not record[field]: - missing_fields.append(record._fields[field].string) - if missing_fields: - raise UserError( - _('To perform the checkin the following data are missing:\ - %s') % (', '.join(missing_fields))) - if not record.reservation_id.segmentation_ids: - raise UserError( - _('To perform the checkin the segmentation is required')) diff --git a/hotel_l10n_es/models/inherit_hotel_reservation.py b/hotel_l10n_es/models/inherit_hotel_reservation.py deleted file mode 100644 index 640e5f199..000000000 --- a/hotel_l10n_es/models/inherit_hotel_reservation.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Darío Lodeiros -# -# 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 . -# -############################################################################## -from openerp import models, api - - -class HotelReservation(models.Model): - _inherit = 'hotel.reservation' - - - def print_all_checkins(self): - checkins = self.env['hotel.checkin.partner'] - for record in self: - checkins += record.checkin_partner_ids.filtered( - lambda s: s.state in ('booking', 'done')) - if checkins: - return self.env.ref('hotel_l10n_es.action_report_viajero').\ - report_action(checkins) diff --git a/hotel_l10n_es/models/inherit_res_company.py b/hotel_l10n_es/models/inherit_res_company.py deleted file mode 100755 index 4e70c4b01..000000000 --- a/hotel_l10n_es/models/inherit_res_company.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -import base64 -from odoo import models, fields -from odoo import modules - - -def get_default_img(): - with open(modules.get_module_resource('hotel_l10n_es', 'static/src/img', - 'logo_bn.png'), - 'rb') as f: - return base64.b64encode(f.read()) - - -class Inherit_res_company(models.Model): - _inherit = 'res.company' - - property_name = fields.Char('Property name', - help='Name of the Hotel/Property.') - ine_tourism = fields.Char('Tourism number', - help='Registration number in the Ministry of \ - Tourism. Used for INE statistics.') - ine_rooms = fields.Integer('Rooms Available', default=0, - help='Used for INE statistics.') - ine_seats = fields.Integer('Beds available', default=0, - help='Used for INE statistics.') - ine_permanent_staff = fields.Integer('Permanent Staff', default=0, - help='Used for INE statistics.') - ine_eventual_staff = fields.Integer('Eventual Staff', default=0, - help='Used for INE statistics.') - police_number = fields.Char('Police number', size=10, - help='Used to generate the name of the file that \ - will be given to the police. 10 Caracters') - ine_category_id = fields.Many2one('tourism.category', - help='Hotel category in the Ministry of \ - Tourism. Used for INE statistics.') - checkin_img = fields.Binary(string="Image in checkin", - default=get_default_img()) diff --git a/hotel_l10n_es/models/inherit_res_partner.py b/hotel_l10n_es/models/inherit_res_partner.py deleted file mode 100755 index d9102b6d9..000000000 --- a/hotel_l10n_es/models/inherit_res_partner.py +++ /dev/null @@ -1,450 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -import functools -import itertools -import logging -import psycopg2 - -from odoo import api, fields, models, _ -from odoo.osv.expression import get_unaccent_wrapper -from odoo.exceptions import ValidationError, UserError -from odoo.tools import mute_logger -_logger = logging.getLogger(__name__) - - -class ResPartner(models.Model): - _inherit = 'res.partner' - - document_type = fields.Selection([ - ('D', 'DNI'), - ('P', 'Pasaporte'), - ('C', 'Permiso de Conducir'), - ('I', 'Carta o Doc. de Identidad'), - ('N', 'Permiso Residencia Español'), - ('X', 'Permiso Residencia Europeo')], - help=_('Select a valid document type'), - string='Doc. type', - ) - document_number = fields.Char('Document number', index=True) - document_expedition_date = fields.Date('Document expedition date') - code_ine_id = fields.Many2one('code.ine', - help=_('Country or province of origin. Used for INE statistics.')) - unconfirmed = fields.Boolean('Unconfirmed', default=True) - main_partner_id = fields.Many2one('res.partner') - - @api.model - def name_search(self, name, args=None, operator='ilike', limit=100): - if not args: - args = [] - domain = ['|', - ('document_number', operator, name), - ('vat', operator, name), - ] - partners = self.search(domain + args, limit=limit,) - res = partners.name_get() - if limit: - limit_rest = limit - len(partners) - else: - limit_rest = limit - if limit_rest or not limit: - args += [('id', 'not in', partners.ids)] - res += super(ResPartner, self).name_search( - name, args=args, operator=operator, limit=limit_rest) - return res - - @api.model - def _get_duplicated_ids(self, partner): - partner_ids = [] - if partner.vat: - partner_ids += self.env['res.partner'].search([ - ('vat', '=', partner.vat), - ('parent_id', '=', False) - ]).ids - if partner.document_number: - partner_ids += self.env['res.partner'].search([ - ('document_number', '=', partner.document_number), - ('child_ids', '=', False) - ]).ids - if partner_ids: - return partner_ids - - def _merge_fields(self): - duplicated_fields = ['vat', 'document_number'] - return duplicated_fields - - - def write(self, vals): - if vals.get('vat') and not self._context.get( - "ignore_vat_update", False): - for record in self: - vat = vals.get('vat') - if self.env.context.get('company_id'): - company = self.env['res.company'].browse(self.env.context['company_id']) - else: - company = self.env.user.company_id - if company.vat_check_vies: - # force full VIES online check - check_func = self.vies_vat_check - else: - # quick and partial off-line checksum validation - check_func = self.simple_vat_check - vat_country, vat_number = self._split_vat(vat) - #check with country code as prefix of the TIN - if not check_func(vat_country, vat_number): - country_id = vals.get('country_id') or record.country_id.id - vals['vat'] = record.fix_eu_vat_number(country_id, vat) - return super(ResPartner, self).write(vals) - - @api.constrains('country_id') - def update_vat_code_country(self): - for record in self: - country_id = record.country_id.id - vat = record.vat - #check with country code as prefix of the TIN - if vat: - if self.env.context.get('company_id'): - company = self.env['res.company'].browse(self.env.context['company_id']) - else: - company = self.env.user.company_id - if company.vat_check_vies: - # force full VIES online check - check_func = self.vies_vat_check - else: - # quick and partial off-line checksum validation - check_func = self.simple_vat_check - vat_country, vat_number = self._split_vat(vat) - if not check_func(vat_country, vat_number): - vat_with_code = record.fix_eu_vat_number(country_id, vat) - if country_id and vat != vat_with_code: - record.with_context({'ignore_vat_update': True}).write({ - 'vat': vat_with_code - }) - - @api.constrains('vat', 'commercial_partner_country_id') - def check_vat(self): - spain = self.env['res.country'].search([ - ('code', '=', 'ES') - ]) - from_spain = False - for partner in self: - if partner.country_id == spain: - from_spain = True - if from_spain: - return super(ResPartner, self).check_vat() - - @api.constrains('vat') - def _check_vat_unique(self): - for record in self: - if record.unconfirmed: - if record.vat: - record.update({'unconfirmed': False}) - partner_ids = self.env['res.partner'].search([ - ('vat', '=', record.vat), - ('parent_id', '=', False) - ]).ids - if len(partner_ids) > 1: - partners = self.env['res.partner'].browse(partner_ids) - record._merge(partners._ids) - else: - return super(ResPartner, self)._check_vat_unique() - return True - - @api.constrains('document_number', 'document_type') - def _check_document_number_unique(self): - for record in self: - if not record.document_number: - continue - if record.unconfirmed: - if record.document_number: - record.update({'unconfirmed': False}) - partner_ids = self.env['res.partner'].search([ - ('document_number', '=', record.document_number), - ]).ids - if len(partner_ids) > 1: - partners = self.env['res.partner'].browse(partner_ids) - record._merge(partners._ids) - if not record.parent_id and record.document_type == 'D' \ - and not record.vat: - record.update({ - 'vat': record.document_number, - }) - else: - results = self.env['res.partner'].search_count([ - ('document_type', '=', record.document_type), - ('document_number', '=', record.document_number), - ('id', '!=', record.id) - ]) - if results: - raise ValidationError(_( - "The Document Number %s already exists in another " - "partner.") % record.document_number) - - - def open_main_partner(self): - self.ensure_one() - action = self.env.ref('base.action_partner_form').read()[0] - if self.main_partner_id: - action['views'] = [(self.env.ref('base.view_partner_form').id, 'form')] - action['res_id'] = self.main_partner_id.id - else: - action = {'type': 'ir.actions.act_window_close'} - return action - - def _get_fk_on(self, table): - """ return a list of many2one relation with the given table. - :param table : the name of the sql table to return relations - :returns a list of tuple 'table name', 'column name'. - """ - query = """ - SELECT cl1.relname as table, att1.attname as column - FROM pg_constraint as con, pg_class as cl1, pg_class as cl2, pg_attribute as att1, pg_attribute as att2 - WHERE con.conrelid = cl1.oid - AND con.confrelid = cl2.oid - AND array_lower(con.conkey, 1) = 1 - AND con.conkey[1] = att1.attnum - AND att1.attrelid = cl1.oid - AND cl2.relname = %s - AND att2.attname = 'id' - AND array_lower(con.confkey, 1) = 1 - AND con.confkey[1] = att2.attnum - AND att2.attrelid = cl2.oid - AND con.contype = 'f' - """ - self._cr.execute(query, (table,)) - return self._cr.fetchall() - - def _merge(self, partner_ids, dst_partner=None): - """ private implementation of merge partner - :param partner_ids : ids of partner to merge - :param dst_partner : record of destination res.partner - """ - partner = self.env['res.partner'] - partner_ids = partner.browse(partner_ids).exists() - if len(partner_ids) < 2: - return - - if len(partner_ids) > 3: - raise UserError(_("For safety reasons, you cannot merge more than 3 contacts together. You can re-open the wizard several times if needed.")) - - # check if the list of partners to merge contains child/parent relation - child_ids = self.env['res.partner'] - for partner_id in partner_ids: - child_ids |= partner.search([('id', 'child_of', [partner_id.id])]) - partner_id - if partner_ids & child_ids: - raise UserError(_("You cannot merge a contact with one of his parent.")) - - # remove dst_partner from partners to merge - if dst_partner and dst_partner in partner_ids: - src_partners = partner_ids - dst_partner - else: - ordered_partners = self._get_ordered_partner(partner_ids.ids) - dst_partner = ordered_partners[-1] - src_partners = ordered_partners[:-1] - _logger.info("dst_partner: %s", dst_partner.id) - - # call sub methods to do the merge - self._update_foreign_keys(src_partners, dst_partner) - self._update_reference_fields(src_partners, dst_partner) - self._update_values(src_partners, dst_partner) - - _logger.info('(uid = %s) merged the partners %r with %s', self._uid, src_partners.ids, dst_partner.id) - dst_partner.message_post(body='%s %s' % (_("Merged with the following partners:"), ", ".join('%s <%s> (ID %s)' % (p.name, p.email or 'n/a', p.id) for p in src_partners))) - - return dst_partner - - @api.model - def _update_foreign_keys(self, src_partners, dst_partner): - """ Update all foreign key from the src_partner to dst_partner. All many2one fields will be updated. - :param src_partners : merge source res.partner recordset (does not include destination one) - :param dst_partner : record of destination res.partner - """ - _logger.debug('_update_foreign_keys for dst_partner: %s for src_partners: %s', dst_partner.id, str(src_partners.ids)) - - # find the many2one relation to a partner - partner = self.env['res.partner'] - relations = self._get_fk_on('res_partner') - - for table, column in relations: - # get list of columns of current table (exept the current fk column) - query = "SELECT column_name FROM information_schema.columns WHERE table_name LIKE '%s'" % (table) - self._cr.execute(query, ()) - columns = [] - for data in self._cr.fetchall(): - if data[0] != column: - columns.append(data[0]) - - # do the update for the current table/column in SQL - query_dic = { - 'table': table, - 'column': column, - 'value': columns[0], - } - if len(columns) <= 1: - # unique key treated - query = """ - UPDATE "%(table)s" as ___tu - SET %(column)s = %%s - WHERE - %(column)s = %%s AND - NOT EXISTS ( - SELECT 1 - FROM "%(table)s" as ___tw - WHERE - %(column)s = %%s AND - ___tu.%(value)s = ___tw.%(value)s - )""" % query_dic - for partner in src_partners: - self._cr.execute(query, (dst_partner.id, partner.id, dst_partner.id)) - else: - try: - with mute_logger('odoo.sql_db'), self._cr.savepoint(): - query = 'UPDATE "%(table)s" SET %(column)s = %%s WHERE %(column)s IN %%s' % query_dic - self._cr.execute(query, (dst_partner.id, tuple(src_partners.ids),)) - - # handle the recursivity with parent relation - if column == partner._parent_name and table == 'res_partner': - query = """ - WITH RECURSIVE cycle(id, parent_id) AS ( - SELECT id, parent_id FROM res_partner - UNION - SELECT cycle.id, res_partner.parent_id - FROM res_partner, cycle - WHERE res_partner.id = cycle.parent_id AND - cycle.id != cycle.parent_id - ) - SELECT id FROM cycle WHERE id = parent_id AND id = %s - """ - self._cr.execute(query, (dst_partner.id,)) - # NOTE JEM : shouldn't we fetch the data ? - except psycopg2.Error: - # updating fails, most likely due to a violated unique constraint - # keeping record with nonexistent partner_id is useless, better delete it - query = 'DELETE FROM "%(table)s" WHERE "%(column)s" IN %%s' % query_dic - self._cr.execute(query, (tuple(src_partners.ids),)) - - @api.model - def _update_reference_fields(self, src_partners, dst_partner): - """ Update all reference fields from the src_partner to dst_partner. - :param src_partners : merge source res.partner recordset (does not include destination one) - :param dst_partner : record of destination res.partner - """ - _logger.debug('_update_reference_fields for dst_partner: %s for src_partners: %r', dst_partner.id, src_partners.ids) - - def update_records(model, src, field_model='model', field_id='res_id'): - Model = self.env[model] if model in self.env else None - if Model is None: - return - records = Model.sudo().search([(field_model, '=', 'res.partner'), (field_id, '=', src.id)]) - try: - with mute_logger('odoo.sql_db'), self._cr.savepoint(): - return records.sudo().write({field_id: dst_partner.id}) - except psycopg2.Error: - # updating fails, most likely due to a violated unique constraint - # keeping record with nonexistent partner_id is useless, better delete it - return records.sudo().unlink() - - update_records = functools.partial(update_records) - - for partner in src_partners: - update_records('calendar', src=partner, field_model='model_id.model') - update_records('ir.attachment', src=partner, field_model='res_model') - update_records('mail.followers', src=partner, field_model='res_model') - update_records('mail.message', src=partner) - update_records('ir.model.data', src=partner) - - records = self.env['ir.model.fields'].search([('ttype', '=', 'reference')]) - for record in records.sudo(): - try: - Model = self.env[record.model] - field = Model._fields[record.name] - except KeyError: - # unknown model or field => skip - continue - - if field.compute is not None: - continue - - for partner in src_partners: - records_ref = Model.sudo().search([(record.name, '=', 'res.partner,%d' % partner.id)]) - values = { - record.name: 'res.partner,%d' % dst_partner.id, - } - records_ref.sudo().write(values) - - @api.model - def _update_values(self, src_partners, dst_partner): - """ Update values of dst_partner with the ones from the src_partners. - :param src_partners : recordset of source res.partner - :param dst_partner : record of destination res.partner - """ - _logger.debug('_update_values for dst_partner: %s for src_partners: %r', dst_partner.id, src_partners.ids) - - model_fields = dst_partner.fields_get().keys() - - def write_serializer(item): - if isinstance(item, models.BaseModel): - return item.id - else: - return item - # get all fields that are not computed or x2many - values = dict() - for column in model_fields: - field = dst_partner._fields[column] - if field.type not in ('many2many', 'one2many') and field.compute is None: - for item in itertools.chain(src_partners, [dst_partner]): - if item[column]: - values[column] = write_serializer(item[column]) - # remove fields that can not be updated (id and parent_id) - values.pop('id', None) - parent_id = values.pop('parent_id', None) - src_partners.update({ - 'active': False, - 'document_number': False, - 'vat': False, - 'main_partner_id': dst_partner.id}) - dst_partner.write(values) - # try to update the parent_id - if parent_id and parent_id != dst_partner.id: - try: - dst_partner.write({'parent_id': parent_id}) - except ValidationError: - _logger.info('Skip recursive partner hierarchies for parent_id %s of partner: %s', parent_id, dst_partner.id) - - @api.model - def _get_ordered_partner(self, partner_ids): - """ Helper : returns a `res.partner` recordset ordered by create_date/active fields - :param partner_ids : list of partner ids to sort - """ - return self.env['res.partner'].browse(partner_ids).sorted( - key=lambda p: (p.active, (p.create_date or '')), - reverse=True, - ) - - - def _compute_models(self): - """ Compute the different models needed by the system if you want to exclude some partners. """ - model_mapping = {} - if self.exclude_contact: - model_mapping['res.users'] = 'partner_id' - if 'account.move.line' in self.env and self.exclude_journal_item: - model_mapping['account.move.line'] = 'partner_id' - return model_mapping diff --git a/hotel_l10n_es/report/report_parte_viajero.xml b/hotel_l10n_es/report/report_parte_viajero.xml deleted file mode 100755 index cfaaf4b2d..000000000 --- a/hotel_l10n_es/report/report_parte_viajero.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/hotel_l10n_es/security/ir.model.access.csv b/hotel_l10n_es/security/ir.model.access.csv deleted file mode 100755 index 7a6b2cc1c..000000000 --- a/hotel_l10n_es/security/ir.model.access.csv +++ /dev/null @@ -1,7 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_hotel_l10n_es.model_category_user","hotell10n.category_ine.user","hotel_l10n_es.model_tourism_category","hotel.group_hotel_user",1,0,0,0 -"access_hotel_l10n_es.code_ine_user","hotell10n.code_ine.user","hotel_l10n_es.model_code_ine","hotel.group_hotel_user",1,0,0,0 -"access_hotel_l10n_es.model_category_manager","hotell10n.category_ine.manager","hotel_l10n_es.model_tourism_category","hotel.group_hotel_manager",1,1,1,1 -"access_hotel_l10n_es.code_ine_manager","hotell10n.code_ine.manager","hotel_l10n_es.model_code_ine","hotel.group_hotel_manager",1,1,1,1 -"access_hotel_l10n_es.model_category_call","hotell10n.category_ine.call","hotel_l10n_es.model_tourism_category","hotel.group_hotel_call",1,0,0,0 -"access_hotel_l10n_es.code_ine_call","hotell10n.code_ine.call","hotel_l10n_es.model_code_ine","hotel.group_hotel_call",1,0,0,0 diff --git a/hotel_l10n_es/static/description/icon.png b/hotel_l10n_es/static/description/icon.png deleted file mode 100755 index 367e0ad23..000000000 Binary files a/hotel_l10n_es/static/description/icon.png and /dev/null differ diff --git a/hotel_l10n_es/static/src/css/hotel_l10n_es.css b/hotel_l10n_es/static/src/css/hotel_l10n_es.css deleted file mode 100755 index 0df19d423..000000000 --- a/hotel_l10n_es/static/src/css/hotel_l10n_es.css +++ /dev/null @@ -1,5 +0,0 @@ -#odooAppDrawer{background: #FFFFFF url(../img/watermark.jpg) no-repeat fixed center} -tbody tr td div.o_datepicker.o_form_field_date.o_form_field.o_form_required{max-width: 9.5em} -.title-hotel-name{font-size: 20px;position: absolute;text-align: center;width: 100%;color: #45c2b1;font-weight: bold;z-index: -1;} -.title-hotel-name2{font-size: 20px;position: absolute;text-align: center;width: 100%;color: #45c2b1;font-weight: bold;z-index: -1;} -body {background-color: blue;} diff --git a/hotel_l10n_es/static/src/img/logo_bn.png b/hotel_l10n_es/static/src/img/logo_bn.png deleted file mode 100755 index 98aa826fd..000000000 Binary files a/hotel_l10n_es/static/src/img/logo_bn.png and /dev/null differ diff --git a/hotel_l10n_es/static/src/img/watermark.jpg b/hotel_l10n_es/static/src/img/watermark.jpg deleted file mode 100755 index 7011f12c1..000000000 Binary files a/hotel_l10n_es/static/src/img/watermark.jpg and /dev/null differ diff --git a/hotel_l10n_es/static/src/xml/hotel_l10n_es_templates.xml b/hotel_l10n_es/static/src/xml/hotel_l10n_es_templates.xml deleted file mode 100644 index 7470efb3b..000000000 --- a/hotel_l10n_es/static/src/xml/hotel_l10n_es_templates.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/hotel_l10n_es/views/category_tourism.xml b/hotel_l10n_es/views/category_tourism.xml deleted file mode 100755 index fff2798a2..000000000 --- a/hotel_l10n_es/views/category_tourism.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - tourism.category.view.form - tourism.category - -
      - - - - - - - - - - - - - -
      -
      -
      - - - tourism.category.view.tree - tourism.category - - - - - - - -
      diff --git a/hotel_l10n_es/views/code_ine.xml b/hotel_l10n_es/views/code_ine.xml deleted file mode 100755 index d2f5b831b..000000000 --- a/hotel_l10n_es/views/code_ine.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - code.ine.view.form - code.ine - -
      - - - - - - - - - - - - - -
      -
      -
      - - - code.ine.view.tree - code.ine - - - - - - - - -
      diff --git a/hotel_l10n_es/views/hotel_l10n_es_hotel_name.xml b/hotel_l10n_es/views/hotel_l10n_es_hotel_name.xml deleted file mode 100755 index c808e8ebd..000000000 --- a/hotel_l10n_es/views/hotel_l10n_es_hotel_name.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/hotel_l10n_es/views/inherit_hotel_checkin_partner_views.xml b/hotel_l10n_es/views/inherit_hotel_checkin_partner_views.xml deleted file mode 100755 index 853dd6c65..000000000 --- a/hotel_l10n_es/views/inherit_hotel_checkin_partner_views.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - hotel.checkin.partner.view.form - hotel.checkin.partner - - - - - - - - - - - - - - - -
      - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hotel_l10n_es/views/inherited_hotel_reservation_views.xml b/hotel_l10n_es/views/inherited_hotel_reservation_views.xml deleted file mode 100644 index bbf2979e7..000000000 --- a/hotel_l10n_es/views/inherited_hotel_reservation_views.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - hotel.reservation - - - -
      - -
      -

      -

      -
      -
      - -
      -

      Abrir web de la Polícia para entregar el fichero generado: Policia

      -

      Abrir web de la Guardia Civil para entregar el fichero generado: Guardia Civil

      -
      -
      - - - - - - - - diff --git a/hotel_roommatik/__init__.py b/hotel_roommatik/__init__.py deleted file mode 100755 index 0650744f6..000000000 --- a/hotel_roommatik/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models diff --git a/hotel_roommatik/__manifest__.py b/hotel_roommatik/__manifest__.py deleted file mode 100755 index 30719f197..000000000 --- a/hotel_roommatik/__manifest__.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2018 Jose Luis Algara (Alda hotels) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -{ - 'name': 'Hotel RoomMatik', - 'description': """ - Integration of Hootel with the RoomMatik kiosk""", - 'summary': """ - The integration of Hootel with the RoomMatik kiosk. - A series of requests/responses that provide the basic - information needed by the kiosk.""", - 'version': '11.0.1.0.0', - 'license': 'AGPL-3', - 'author': 'Jose Luis Algara (Alda hotels) ', - 'website': 'https://www.aldahotels.com', - 'category': 'Generic Modules/Hotel Management', - 'depends': [ - 'hotel', - 'partner_contact_gender', - 'partner_contact_birthdate', - 'base_iso3166', - 'base_location', - ], - 'data': [ - 'data/res_users_data.xml' - ], - 'demo': [ - ], -} diff --git a/hotel_roommatik/data/res_users_data.xml b/hotel_roommatik/data/res_users_data.xml deleted file mode 100644 index d22fa0178..000000000 --- a/hotel_roommatik/data/res_users_data.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - Roommatik - - - - - - - roommatik@roommatik.com - - - - - - - --
      -Roommatik]]>
      - -
      -
      -
      diff --git a/hotel_roommatik/models/__init__.py b/hotel_roommatik/models/__init__.py deleted file mode 100755 index 6a96de1e6..000000000 --- a/hotel_roommatik/models/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from . import inherited_hotel_checkin_partner -from . import inherited_res_partner -from . import inherited_hotel_room_type -from . import roommatik -from . import inherited_hotel_reservation -from . import inherited_account_payment diff --git a/hotel_roommatik/models/inherited_account_payment.py b/hotel_roommatik/models/inherited_account_payment.py deleted file mode 100644 index e6c2ef37e..000000000 --- a/hotel_roommatik/models/inherited_account_payment.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.exceptions import except_orm -from odoo import models, fields, api, _ - -class AccountPayment(models.Model): - _inherit = 'account.payment' - - @api.model - def rm_add_payment(self, code, payment): - reservation = self.env['hotel.reservation'].search([ - '|', ('localizator', '=', code), - ('folio_id.name', '=', code)]) - if not reservation: - return False - if reservation: - for cashpay in payment['CashPayments']: - vals = { - 'journal_id': 7, # TODO:config setting - 'partner_id': reservation.partner_invoice_id.id, - 'amount': cashpay['Amount'], - 'payment_date': cashpay['DateTime'], - 'communication': reservation.name, - 'folio_id': reservation.folio_id.id, - 'payment_type': 'inbound', - 'payment_method_id': 1, - 'partner_type': 'customer', - 'state': 'draft', - } - pay = self.create(vals) - for cashpay in payment['CreditCardPayments']: - vals = { - 'journal_id': 15, # TODO:config setting - 'partner_id': reservation.partner_invoice_id.id, - 'amount': cashpay['Amount'], - 'payment_date': cashpay['DateTime'], - 'communication': reservation.name, - 'folio_id': reservation.folio_id.id, - 'payment_type': 'inbound', - 'payment_method_id': 1, - 'partner_type': 'customer', - 'state': 'draft', - } - pay = self.create(vals) - pay.post() - return True diff --git a/hotel_roommatik/models/inherited_hotel_checkin_partner.py b/hotel_roommatik/models/inherited_hotel_checkin_partner.py deleted file mode 100644 index d3e83a21e..000000000 --- a/hotel_roommatik/models/inherited_hotel_checkin_partner.py +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright 2019 Jose Luis Algara (Alda hotels) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import json -from odoo import api, models -from odoo.addons.hotel_roommatik.models.roommatik import ( - DEFAULT_ROOMMATIK_DATE_FORMAT, - DEFAULT_ROOMMATIK_DATETIME_FORMAT) -from datetime import datetime -import logging - - -class HotelCheckinPartner(models.Model): - - _inherit = 'hotel.checkin.partner' - - @api.model - def rm_checkin_partner(self, stay): - _logger = logging.getLogger(__name__) - if not stay.get('ReservationCode'): - reservation_obj = self.env['hotel.reservation'] - vals = { - 'checkin': stay["Arrival"], - 'checkout': stay["Departure"], - 'adults': stay['Adults'], - 'arrival_hour': stay['Arrival_hour'], - 'room_type_id': stay['RoomType']['Id'], - 'partner_id': stay["Customers"][0]["Id"], - 'segmentation_ids': [(6, 0, [stay['Segmentation']])], - 'channel_type': 'virtualdoor', - } - reservation_rm = reservation_obj.create(vals) - stay['ReservationCode'] = reservation_rm.localizator - else: - reservation_rm = self.env['hotel.reservation'].search([ - ('localizator', '=', stay['ReservationCode']) - ]) - total_chekins = reservation_rm.checkin_partner_pending_count - stay['Total'] = reservation_rm.folio_pending_amount - stay['Paid'] = reservation_rm._computed_deposit_roommatik(stay['ReservationCode']) - if total_chekins > 0 and len(stay["Customers"]) <= total_chekins: - _logger.info('ROOMMATIK checkin %s customer in %s Reservation.', - total_chekins, - reservation_rm.id) - for room_partner in stay["Customers"]: - if room_partner['Address']['Nationality'] == 'ESP': - code_ine = room_partner['Address']['Province'] - else: - code_ine = room_partner['Address']['Nationality'] - province = self.env['code.ine'].search( - [('name', '=', code_ine)], limit=1) - code_ine = province.id - - checkin_partner_val = { - 'folio_id': reservation_rm.folio_id.id, - 'reservation_id': reservation_rm.id, - 'partner_id': room_partner["Id"], - 'enter_date': stay["Arrival"], - 'exit_date': stay["Departure"], - 'code_ine_id': code_ine, - } - try: - record = self.env['hotel.checkin.partner'].create( - checkin_partner_val) - _logger.info('ROOMMATIK check-in partner: %s in \ - (%s Reservation) ID:%s.', - checkin_partner_val['partner_id'], - checkin_partner_val['reservation_id'], - record.id) - if not record.reservation_id.segmentation_ids: - record.reservation_id.update({ - 'segmentation_ids': [(6, 0, [stay['Segmentation']])] - }) - record.action_on_board() - stay['Id'] = record.id - stay['Room'] = {} - stay['Room']['Id'] = reservation_rm.room_id.id - stay['Room']['Name'] = reservation_rm.room_id.name - json_response = stay - except Exception as e: - error_name = 'Error not create Checkin ' - error_name += str(e) - json_response = {'State': error_name} - _logger.error('ROOMMATIK writing %s in reservation: %s).', - checkin_partner_val['partner_id'], - checkin_partner_val['reservation_id']) - return json_response - - else: - json_response = {'State': 'Error checkin_partner_pending_count \ - values do not match.'} - _logger.error('ROOMMATIK checkin pending count do not match for \ - Reservation ID %s.', reservation_rm.id) - json_response = json.dumps(json_response) - return json_response - - @api.model - def rm_get_stay(self, code): - # BUSQUEDA POR LOCALIZADOR - checkin_partner = self.search([('id', '=', code)]) - # TODO: refactoring 'res.config.settings', 'default_arrival_hour' by the current self.env.user.hotel_id.arrival_hour - default_arrival_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_arrival_hour') - # TODO: refactoring 'res.config.settings', 'default_departure_hour' by the current self.env.user.hotel_id.departure_hour - default_departure_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_departure_hour') - if any(checkin_partner): - arrival = checkin_partner.enter_date or default_arrival_hour - departure = checkin_partner.exit_date or default_departure_hour - stay = {'Code': checkin_partner.id} - stay['Id'] = checkin_partner.id - stay['Room'] = {} - stay['Room']['Id'] = checkin_partner.reservation_id.room_id.id - stay['Room']['Name'] = checkin_partner.reservation_id.room_id.name - stay['RoomType'] = {} - stay['RoomType']['Id'] = checkin_partner.reservation_id.room_type_id.id - stay['RoomType']['Name'] = checkin_partner.reservation_id.room_type_id.name - stay['Arrival'] = arrival - stay['Departure'] = departure - stay['Customers'] = [] - for idx, cpi in enumerate(checkin_partner.reservation_id.checkin_partner_ids): - stay['Customers'].append({'Customer': {}}) - stay['Customers'][idx]['Customer'] = self.env[ - 'res.partner'].rm_get_a_customer(cpi.partner_id.id) - stay['TimeInterval'] = {} - stay['TimeInterval']['Id'] = {} - stay['TimeInterval']['Name'] = {} - stay['TimeInterval']['Minutes'] = {} - stay['Adults'] = checkin_partner.reservation_id.adults - stay['ReservationCode'] = checkin_partner.reservation_id.localizator - stay['Total'] = checkin_partner.reservation_id.price_total - stay['Paid'] = checkin_partner.reservation_id.folio_id.invoices_paid - stay['Outstanding'] = checkin_partner.reservation_id.folio_id.pending_amount - stay['Taxable'] = checkin_partner.reservation_id.price_tax - - else: - stay = {'Code': ""} - - json_response = json.dumps(stay) - return json_response diff --git a/hotel_roommatik/models/inherited_hotel_reservation.py b/hotel_roommatik/models/inherited_hotel_reservation.py deleted file mode 100644 index 1938f3612..000000000 --- a/hotel_roommatik/models/inherited_hotel_reservation.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 2019 Jose Luis Algara (Alda hotels) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import api, models -import json -import logging -_logger = logging.getLogger(__name__) - - -class HotelReservation(models.Model): - - _inherit = 'hotel.reservation' - - @api.model - def _computed_deposit_roommatik(self, rm_localizator): - reservations = self.env['hotel.reservation'].search([ - ('localizator', '=', rm_localizator)]) - folio = reservations[0].folio_id - # We dont have the payments by room, that's why we have to computed - # the proportional deposit part if the folio has more rooms that the - # reservations code (this happens when in the same folio are - # reservations with different checkins/outs convinations) - if len(folio.reservation_ids) > len(reservations) and folio.invoices_paid > 0: - - total_reservations = sum(reservations.mapped('price_total')) - paid_in_folio = folio.invoices_paid - total_in_folio = folio.amount_total - deposit = total_reservations * paid_in_folio / total_in_folio - return deposit - return folio.invoices_paid - - @api.model - def rm_get_reservation(self, code): - # Search by localizator - reservations = self._get_reservations_roommatik(code) - reservations = reservations.filtered( - lambda x: x.state in ('draft', 'confirm')) - if any(reservations): - # TODO: refactoring 'res.config.settings', 'default_arrival_hour' by the current self.env.user.hotel_id.arrival_hour - default_arrival_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_arrival_hour') - checkin = "%s %s" % (reservations[0].checkin, - default_arrival_hour) - # TODO: refactoring 'res.config.settings', 'default_departure_hour' by the current self.env.user.hotel_id.departure_hour - default_departure_hour = self.env['ir.default'].sudo().get( - 'res.config.settings', 'default_departure_hour') - checkout = "%s %s" % (reservations[0].checkout, - default_departure_hour) - _logger.info('ROOMMATIK serving Folio: %s', reservations.ids) - json_response = { - 'Reservation': { - 'Id': reservations[0].localizator, - 'Arrival': checkin, - 'Departure': checkout, - 'Deposit': self._computed_deposit_roommatik(code) - } - } - for i, line in enumerate(reservations): - total_chekins = line.checkin_partner_pending_count - json_response['Reservation'].setdefault('Rooms', []).append({ - 'Id': line.id, - 'Adults': line.adults, - 'IsAvailable': total_chekins > 0, - # IsAvailable “false” Rooms not need check-in - 'Price': line.price_total, - 'RoomTypeId': line.room_type_id.id, - 'RoomTypeName': line.room_type_id.name, - 'RoomName': line.room_id.name, - }) - else: - _logger.warning('ROOMMATIK Not Found reservation search %s', code) - json_response = {'Error': 'Not Found ' + str(code)} - return json.dumps(json_response) - - @api.model - def _get_reservations_roommatik(self, code): - return self.env['hotel.reservation'].search([ - '|', ('localizator', '=', code), - ('folio_id.name', '=', code)]) diff --git a/hotel_roommatik/models/inherited_hotel_room_type.py b/hotel_roommatik/models/inherited_hotel_room_type.py deleted file mode 100644 index d6110edb4..000000000 --- a/hotel_roommatik/models/inherited_hotel_room_type.py +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2019 Jose Luis Algara (Alda hotels) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import api, models, fields -from datetime import datetime, timedelta -import json -from odoo.addons.hotel_roommatik.models.roommatik import ( - DEFAULT_ROOMMATIK_DATE_FORMAT,) -import logging -_logger = logging.getLogger(__name__) - - -class HotelRoomType(models.Model): - - _inherit = "hotel.room.type" - - @api.model - def rm_get_all_room_type_rates(self): - room_types = self.env['hotel.room.type'].search([]) - # TODO: refactoring 'res.config.settings', 'default_departure_hour' by the current self.env.user.hotel_id - tz_hotel = self.env['ir.default'].sudo().get( - 'res.config.settings', 'tz_hotel') - dfrom = fields.Date.context_today(self.with_context( - tz=tz_hotel)) - dto = (fields.Date.from_string(dfrom) + timedelta(days=1)).strftime( - DEFAULT_ROOMMATIK_DATE_FORMAT) - room_type_rates = [] - for room_type in room_types: - free_rooms = self.check_availability_room_type(dfrom, dto, - room_type.id) - rates = self.get_rate_room_types( - room_type_ids=room_type.id, - date_from=dfrom, - days=1, - partner_id=False) - room_type_rates.append({ - "RoomType": { - "Id": room_type.id, - "Name": room_type.name, - "GuestNumber": room_type.get_capacity() - }, - "TimeInterval": { - "Id": "1", - "Name": "1 day", - "Minutes": "1440" - }, - "Price": rates[room_type.id][0].get('price'), - "IsAvailable": any(free_rooms), - }) - json_response = json.dumps(room_type_rates) - return json_response - - @api.model - def rm_get_prices(self, start_date, number_intervals, - room_type, guest_number): - start_date = fields.Date.from_string(start_date) - end_date = start_date + timedelta(days=int(number_intervals)) - dfrom = start_date.strftime( - DEFAULT_ROOMMATIK_DATE_FORMAT) - dto = end_date.strftime( - DEFAULT_ROOMMATIK_DATE_FORMAT) - free_rooms = self.check_availability_room_type(dfrom, dto, - room_type.id) - if free_rooms: - rates = self.get_rate_room_types( - room_type_ids=room_type.id, - date_from=dfrom, - days=int(number_intervals), - partner_id=False) - return [item['price'] for item in rates.get(room_type.id)] - return [] diff --git a/hotel_roommatik/models/inherited_res_partner.py b/hotel_roommatik/models/inherited_res_partner.py deleted file mode 100755 index c806401da..000000000 --- a/hotel_roommatik/models/inherited_res_partner.py +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright 2019 Jose Luis Algara (Alda hotels) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import json -from odoo import api, models -from datetime import datetime -import logging -from odoo.addons.hotel_roommatik.models.roommatik import ( - DEFAULT_ROOMMATIK_DATE_FORMAT) - - -class ResPartner(models.Model): - - _inherit = 'res.partner' - - @api.model - def rm_add_customer(self, customer): - # RoomMatik API CREACIÓN DE CLIENTE - _logger = logging.getLogger(__name__) - - partner_res = self.env['res.partner'].search([( - 'document_number', '=', - customer['IdentityDocument']['Number'])]) - - json_response = {'Id': 0} - write_customer = False - if any(partner_res): - # Change customer data - try: - partner_res[0].update(self.rm_prepare_customer(customer)) - write_customer = partner_res[0] - _logger.info('ROOMMATIK %s exist in BD [ %s ] Rewriting', - partner_res[0].document_number, - partner_res[0].id,) - except Exception as e: - if 'args' in e.__dir__(): - error_name = e.args - else: - error_name = e.name - else: - # Create new customer - try: - self.create(self.rm_prepare_customer(customer)) - _logger.info('ROOMMATIK Created %s Name: %s', - customer['IdentityDocument']['Number'], - customer['FirstName']) - write_customer = self.env['res.partner'].search([ - ('document_number', '=', - customer['IdentityDocument']['Number'])]) - except Exception as e: - if 'args' in e.__dir__(): - error_name = e.args - else: - error_name = e.name - - partner_res = self.env['res.partner'].search([( - 'document_number', '=', - customer['IdentityDocument']['Number'])]) - partner_res.unlink() - - - if write_customer: - json_response = self.rm_get_a_customer(write_customer.id) - json_response = json.dumps(json_response) - return json_response - else: - _logger.error(error_name) - return [False, error_name] - - def rm_prepare_customer(self, customer): - zip = self.env['res.better.zip'].search([ - ('name', 'ilike', customer['Address']['ZipCode'])]) - # Check Sex string - if customer['Sex'] not in {'male', 'female'}: - customer['Sex'] = '' - # Check state_id - state = self.env['res.country.state'].search([ - ('name', 'ilike', customer['Address']['Province'])]) - if not state and zip: - state = zip.state_id - country = self.env['res.country'].search([ - ('code_alpha3', '=', customer['Address']['Country'])]) - if not country and zip: - country = zip.country_id - # Create Street2s - street_2 = customer['Address']['House'] - street_2 += ' ' + customer['Address']['Flat'] - street_2 += ' ' + customer['Address']['Number'] - metadata = { - 'firstname': customer['FirstName'], - 'lastname': customer['LastName1'] + ' ' + customer['LastName2'], - 'lastname2': '', - 'birthdate_date': datetime.strptime( - customer['Birthday'], DEFAULT_ROOMMATIK_DATE_FORMAT).date(), - 'gender': customer['Sex'], - 'zip': zip, - 'city': customer['Address']['City'], - 'street': customer['Address']['Street'], - 'street2': street_2, - 'state_id': state.id if state else False, - 'country_id': country.id if country else False, - 'phone': customer['Contact']['Telephone'], - 'mobile': customer['Contact']['Mobile'], - 'email': customer['Contact']['Email'], - 'document_number': customer['IdentityDocument']['Number'], - 'document_type': customer['IdentityDocument']['Type'], - 'document_expedition_date': datetime.strptime( - customer['IdentityDocument']['ExpeditionDate'], - DEFAULT_ROOMMATIK_DATE_FORMAT).date(), - } - return {k: v for k, v in metadata.items() if v != ""} - - def rm_get_a_customer(self, customer): - # Prepare a Customer for RoomMatik - partner = self.search([('id', '=', customer)]) - response = {} - response['Id'] = partner.id - response['FirstName'] = partner.firstname - response['LastName1'] = partner.lastname - response['LastName2'] = '' - response['Birthday'] = partner.birthdate_date - response['Sex'] = partner.gender - response['Address'] = { - # 'Nationality': 'xxxxx' - 'Country': partner.country_id.code_alpha3, - 'ZipCode': partner.zip if partner.zip else "", - 'City': partner.city if partner.city else "", - 'Street': partner.street if partner.street else "", - 'House': partner.street2 if partner.street2 else "", - # 'Flat': "xxxxxxx", - # 'Number': "xxxxxxx", - 'Province': partner.state_id.name if partner.state_id.name else "", - } - response['IdentityDocument'] = { - 'Number': partner.document_number, - 'Type': partner.document_type, - 'ExpiryDate': "", - 'ExpeditionDate': partner.document_expedition_date, - } - response['Contact'] = { - 'Telephone': partner.phone if partner.phone else "", - # 'Fax': 'xxxxxxx', - 'Mobile': partner.mobile if partner.mobile else "", - 'Email': partner.email if partner.email else "", - } - return response diff --git a/hotel_roommatik/models/roommatik.py b/hotel_roommatik/models/roommatik.py deleted file mode 100755 index 01e55ae17..000000000 --- a/hotel_roommatik/models/roommatik.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright 2019 Jose Luis Algara (Alda hotels) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import json -from datetime import datetime -from odoo import api, models, fields -# from odoo.tools import ( -# DEFAULT_SERVER_DATE_FORMAT, -# DEFAULT_SERVER_DATETIME_FORMAT) -import logging -_logger = logging.getLogger(__name__) - -DEFAULT_ROOMMATIK_DATE_FORMAT = "%Y-%m-%d" -DEFAULT_ROOMMATIK_TIME_FORMAT = "%H:%M:%S" -DEFAULT_ROOMMATIK_DATETIME_FORMAT = "%s %s" % ( - DEFAULT_ROOMMATIK_DATE_FORMAT, - DEFAULT_ROOMMATIK_TIME_FORMAT) - -class RoomMatik(models.Model): - _name = 'roommatik.api' - - @api.model - def rm_get_date(self): - # RoomMatik API Gets the current business date/time. (MANDATORY) - # TODO: refactoring 'res.config.settings', 'default_departure_hour' by the current self.env.user.hotel_id - tz_hotel = self.env['ir.default'].sudo().get( - 'res.config.settings', 'tz_hotel') - self_tz = self.with_context(tz=tz_hotel) - mynow = fields.Datetime.context_timestamp(self_tz, datetime.now()).\ - strftime(DEFAULT_ROOMMATIK_DATETIME_FORMAT) - json_response = { - 'dateTime': mynow - } - json_response = json.dumps(json_response) - return json_response - - @api.model - def rm_get_reservation(self, reservation_code): - # RoomMatik Gets a reservation ready for check-in - # through the provided code. (MANDATORY) - apidata = self.env['hotel.reservation'] - return apidata.sudo().rm_get_reservation(reservation_code) - - @api.model - def rm_add_customer(self, customer): - # RoomMatik API Adds a new PMS customer through the provided parameters - # Addition will be ok if the returned customer has ID. (MANDATORY) - _logger.info('ROOMMATIK Customer Creation') - apidata = self.env['res.partner'] - return apidata.sudo().rm_add_customer(customer) - - @api.model - def rm_checkin_partner(self, stay): - # RoomMatik API Check-in a stay. - # Addition will be ok if the returned stay has ID. (MANDATORY) - _logger.info('ROOMMATIK Check-IN') - apidata = self.env['hotel.checkin.partner'] - return apidata.sudo().rm_checkin_partner(stay) - - @api.model - def rm_get_stay(self, check_in_code): - # RoomMatik API Gets stay information through check-in code - # (if code is related to a current stay) - # (MANDATORY for check-out kiosk) - apidata = self.env['hotel.checkin.partner'] - return apidata.sudo().rm_get_stay(check_in_code) - - @api.model - def rm_get_all_room_type_rates(self): - # Gets the current room rates and availability. (MANDATORY) - # return ArrayOfRoomTypeRate - _logger.info('ROOMMATIK Get Rooms and Rates') - apidata = self.env['hotel.room.type'] - return apidata.sudo().rm_get_all_room_type_rates() - - @api.model - def rm_get_prices(self, start_date, number_intervals, room_type, guest_number): - # Gets some prices related to different dates of the same stay. - # return ArrayOfDecimal - apidata = self.env['hotel.room.type'] - room_type = apidata.browse(int(room_type)) - _logger.info('ROOMMATIK Get Prices') - if not room_type: - return {'State': 'Error Room Type not Found'} - return apidata.sudo().rm_get_prices(start_date, number_intervals, room_type, guest_number) - - @api.model - def rm_get_segmentation(self): - # Gets segmentation list - # return ArrayOfSegmentation - segmentations = self.env['res.partner.category'].sudo().search([]) - _logger.info('ROOMMATIK Get segmentation') - response = [] - for segmentation in segmentations: - response.append({ - "Segmentation": { - "Id": segmentation.id, - "Name": segmentation.display_name, - }, - }) - json_response = json.dumps(response) - return json_response - - @api.model - def rm_add_payment(self, code, payment): - apidata = self.env['account.payment'] - return apidata.sudo().rm_add_payment(code, payment) - # Debug Stop ------------------- - # import wdb; wdb.set_trace() - # Debug Stop ------------------- diff --git a/hotel_roommatik/static/description/icon.png b/hotel_roommatik/static/description/icon.png deleted file mode 100755 index 2f06baf55..000000000 Binary files a/hotel_roommatik/static/description/icon.png and /dev/null differ diff --git a/hotel_roommatik/static/img/avatar.png b/hotel_roommatik/static/img/avatar.png deleted file mode 100644 index 2f06baf55..000000000 Binary files a/hotel_roommatik/static/img/avatar.png and /dev/null differ diff --git a/kellys_daily_report/README.rst b/kellys_daily_report/README.rst deleted file mode 100644 index 7bf0177f1..000000000 --- a/kellys_daily_report/README.rst +++ /dev/null @@ -1,13 +0,0 @@ -KELLYS DAILY REPORT -============= - -Export PDF KELLYS REPORT - - -Credits -======= - -Creator ------------- - -* Jose Luis Algara Toledo diff --git a/kellys_daily_report/__init__.py b/kellys_daily_report/__init__.py deleted file mode 100644 index e73c9c829..000000000 --- a/kellys_daily_report/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import models -from . import wizard diff --git a/kellys_daily_report/__manifest__.py b/kellys_daily_report/__manifest__.py deleted file mode 100644 index 1bb6cf00a..000000000 --- a/kellys_daily_report/__manifest__.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Odoo, Open Source Management Solution -# Copyright (C) 2018 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## - -{ - 'name': 'Hotel Kellys Daily Report', - 'version': '2.1', - 'author': "Jose Luis Algara Toledo ", - 'website': 'https://www.aldahotels.com', - 'category': 'hotel report kellys', - 'summary': "Export daily report in PDF format", - 'description': "Kellys Daily Report", - 'depends': [ - 'hotel', - ], - 'data': [ - 'data/report_kellys_paperformat.xml', - 'views/kellysnames.xml', - 'wizard/kellys_daily_rooms.xml', - 'wizard/kellys_daily_pdf.xml', - 'data/menus.xml', - 'report/report_kellys.xml', - 'security/ir.model.access.csv', - ], - 'qweb': [], - 'test': [ - ], - 'css': ['static/src/css/kellys_daily_report.css'], - - 'installable': True, - 'auto_install': False, - 'application': False, - 'license': 'AGPL-3', -} diff --git a/kellys_daily_report/data/menus.xml b/kellys_daily_report/data/menus.xml deleted file mode 100644 index 0bf4c2c43..000000000 --- a/kellys_daily_report/data/menus.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/kellys_daily_report/data/report_kellys_paperformat.xml b/kellys_daily_report/data/report_kellys_paperformat.xml deleted file mode 100644 index 5f6040689..000000000 --- a/kellys_daily_report/data/report_kellys_paperformat.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - Kellys report - - custom - 360 - 60 - Portrait - 1 - 3 - 0 - 0 - - 1 - 201 - - - - diff --git a/kellys_daily_report/models/__init__.py b/kellys_daily_report/models/__init__.py deleted file mode 100644 index 9bba13048..000000000 --- a/kellys_daily_report/models/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2017 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## - -from . import kellysnames diff --git a/kellys_daily_report/models/kellysnames.py b/kellys_daily_report/models/kellysnames.py deleted file mode 100644 index d2b996067..000000000 --- a/kellys_daily_report/models/kellysnames.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 Alda Hotels -# Jose Luis Algara -# -# 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 . -# -############################################################################## -from openerp import models, fields, api - - -class KellysNames(models.Model): - _name = 'kellysnames' - - name = fields.Char('Limpiador/a') diff --git a/kellys_daily_report/report/report_kellys.xml b/kellys_daily_report/report/report_kellys.xml deleted file mode 100644 index 96ecc5af1..000000000 --- a/kellys_daily_report/report/report_kellys.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - diff --git a/kellys_daily_report/security/ir.model.access.csv b/kellys_daily_report/security/ir.model.access.csv deleted file mode 100644 index dcc559a56..000000000 --- a/kellys_daily_report/security/ir.model.access.csv +++ /dev/null @@ -1,4 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_kellys.model_category_manager,access_kellys.manager,kellys_daily_report.model_kellysnames,hotel.group_hotel_manager,1,1,1,1 -access_kellys.model_category_call,access_kellys.call,kellys_daily_report.model_kellysnames,hotel.group_hotel_call,0,0,0,0 -access_kellys.model_category_user,access_kellys.user,kellys_daily_report.model_kellysnames,hotel.group_hotel_user,1,1,1,1 diff --git a/kellys_daily_report/static/description/icon.png b/kellys_daily_report/static/description/icon.png deleted file mode 100644 index 946adacbe..000000000 Binary files a/kellys_daily_report/static/description/icon.png and /dev/null differ diff --git a/kellys_daily_report/static/src/css/kellys_daily_report.css b/kellys_daily_report/static/src/css/kellys_daily_report.css deleted file mode 100644 index 1a2def628..000000000 --- a/kellys_daily_report/static/src/css/kellys_daily_report.css +++ /dev/null @@ -1 +0,0 @@ -.o_datepicker {max-width: 9.5em} diff --git a/kellys_daily_report/views/kellysnames.xml b/kellys_daily_report/views/kellysnames.xml deleted file mode 100644 index 3676787f5..000000000 --- a/kellys_daily_report/views/kellysnames.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - kellysnames - kellysnames.tree.view - - - - - - - - - - diff --git a/kellys_daily_report/wizard/__init__.py b/kellys_daily_report/wizard/__init__.py deleted file mode 100644 index a3dfd1cbe..000000000 --- a/kellys_daily_report/wizard/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2018 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 . -# -############################################################################## -from . import kellys_daily_pdf -from . import kellys_daily_rooms diff --git a/kellys_daily_report/wizard/kellys_daily_pdf.py b/kellys_daily_report/wizard/kellys_daily_pdf.py deleted file mode 100644 index 9a7eb33eb..000000000 --- a/kellys_daily_report/wizard/kellys_daily_pdf.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Odoo, Open Source Management Solution -# Copyright (C) 2018-2019 Jose Luis Algara Toledo -# -# 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 . -# -############################################################################## -from datetime import datetime, date -from odoo import api, fields, models - - -class KellysWizard(models.TransientModel): - _name = 'kellysreport' - - @api.model - def _get_default_date(self): - return date.today() - - def _get_default_habitaciones(self): - return self.calculalimpiar(datetime.now()) - - date_start = fields.Date("Fecha del listado", default=_get_default_date) - habitaciones = fields.Many2many('kellysrooms', string="Limpieza:", - default=_get_default_habitaciones) - order = fields.Selection([ - ('kelly ASC', 'Calendario'), - ('kelly ASC, tipo ASC', 'Limpiar como... y orden en el Calendario'), - ('kelly ASC, tipo ASC, checkin ASC', - 'Limpiar como... y Hora de entrada'), - ], 'Orden de impresión', - default='kelly ASC, tipo ASC, checkin ASC', - required=True, - help='Establece el orden en el que se imprimira el listado') - - - def calculate_report(self): - self.habitaciones = self.calculalimpiar( - datetime.strptime(self.date_start, "%Y-%m-%d")) - return - - - def calculalimpiar(self, fechalimpieza=datetime.now()): - dates = datetime.strftime(fechalimpieza, "%Y-%m-%d") - grids = self.env['hotel.room'].search([], order='sequence ASC') - grids2 = self.env['kellysrooms'] - listid = [] - for x in grids: - rooms = self.env['hotel.reservation'].search( - ['&', '&', ('checkin', '<=', dates), - ('checkout', '>=', dates), - ('state', '<>', 'cancelled'), - ('room_id', '=', x.id) - ], order='checkin ASC') - - tipos = False - if len(rooms) != 0: - if len(rooms) == 2: - tipos = 1 - # Salida y etrada - checkinhour = rooms[1].checkin - checkouthour = rooms[1].checkout[:10] - else: - if rooms[0].checkin[:10] == dates: - checkinhour = rooms[0].checkin - checkouthour = rooms[0].checkout[:10] - tipos = 3 - # Revisar - elif rooms[0].checkout[:10] == dates: - checkinhour = 'no prevista' - checkouthour = '' - tipos = 1 - # Salida - else: - checkinhour = rooms[0].checkin[:10] - checkouthour = rooms[0].checkout[:10] - tipos = 2 - # Cliente - if rooms[0].reservation_type == 'staff': - checkinhour = rooms[0].checkin[:10] - checkouthour = rooms[0].checkout[:10] - tipos = 4 - # Staff - if rooms[0].reservation_type == 'out': - checkinhour = rooms[0].checkin[:10] - checkouthour = rooms[0].checkout[:10] - tipos = 5 - # Averiada - if tipos is not False: - listid.append(grids2.create( - {'habitacion': rooms[0].room_id.name, - 'habitacionid': rooms[0].room_id.id, - 'tipo': tipos, - 'notas': '', - 'checkin': checkinhour, - # 'checkin': rooms[0].checkin[:10], - # 'checkout': rooms[0].checkout[:10], - 'checkout': checkouthour, - # 'kelly': 5, - 'clean_date': fechalimpieza - }).id) - return self.env['kellysrooms'].search([('id', 'in', listid)]) - - - def print_rooms_report(self): - rooms = self.env['kellysrooms'].search([('id', 'in', - self.habitaciones.ids)], - order=self.order) - - return self.env.ref( - 'kellys_daily_report.report_kellysrooms').report_action(rooms) diff --git a/kellys_daily_report/wizard/kellys_daily_pdf.xml b/kellys_daily_report/wizard/kellys_daily_pdf.xml deleted file mode 100644 index 458fcc17b..000000000 --- a/kellys_daily_report/wizard/kellys_daily_pdf.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - kellys_daily_report_view - kellysreport - -
      - - - -