diff --git a/hotel/Doc/ChangeLog.txt b/hotel/Doc/ChangeLog.txt deleted file mode 100644 index 9e2d7b790..000000000 --- a/hotel/Doc/ChangeLog.txt +++ /dev/null @@ -1,28 +0,0 @@ -============================================================================================================================ - Version Change Log (hotel) -============================================================================================================================ -0.07 on 2013-10-31 by Murtuza Saleh - *Improved hotel.room kanban view as per in v9. - -0.06 on 2013-10-29 by Ashish Thakkar - *Set the product_category_tree_view in the hotel_view.xml file. - *Improved the code to get the hierarchy in rooms,amenities and services. - -0.05 on 2013-10-28 by Anu Patel - * Set the default value of check in date and check out date. - * Improved calculation of duration for hotel check in - checkout. - -0.04 on 2013-10-28 by Anu Patel - * Improved ir.sequence for hotel.folio. - * Improved hotel folio line one2many field as faced problem because of product_uos field. - -0.03 on 2013-10-25 by Anu Patel - * Improved on_change in hotel folio line where product_id onchange is not working. - * Removed on_chage from .xml file as there is no need to define there. - -0.02 on 2013-10-26 by Anu Patel - * Improved the code for removed the workflow in hotel folio as workflow is no longer used in v9. - * Improved states used in hotel folio from sale order as per in v9. - -0.01 on 2013-10-16 by Ashish Thakkar - * Made the module installable in v9. diff --git a/hotel/__init__.py b/hotel/__init__.py index 4e39d461f..9e9ffdbb0 100644 --- a/hotel/__init__.py +++ b/hotel/__init__.py @@ -1,8 +1,5 @@ # -*- coding: utf-8 -*- # Copyright 2018 Tecnotel - Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - from . import models from . import wizard -from . import report -from . import date_utils diff --git a/hotel/__manifest__.py b/hotel/__manifest__.py index 06a070f6b..9fccf6821 100644 --- a/hotel/__manifest__.py +++ b/hotel/__manifest__.py @@ -1,66 +1,60 @@ # -*- coding: utf-8 -*- -# Copyright 2018 Alexandre Díaz +# Copyright 2018 Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Hotel Management', - 'version': '0.07', + 'version': '11.0.2.0.0', 'author': 'Odoo Community Association (OCA),\ Darío Lodeiros,\ Jose Luis Algara,\ - Alexandre Díaz', - 'images': [], + Alexandre Díaz,\ + Q. Barriuso,', 'category': 'Generic Modules/Hotel Management', - 'website': '', + 'website': 'https://github.com/hootel/hootel', 'depends': [ 'sale_stock', 'account_payment_return', ], - 'license': "", + 'license': "AGPL-3", 'demo': ['data/hotel_data.xml'], 'data': [ 'security/hotel_security.xml', - 'security/ir.model.access.csv', + # 'security/ir.model.access.csv', 'wizard/massive_changes.xml', 'wizard/split_reservation.xml', 'wizard/duplicate_reservation.xml', 'views/res_config.xml', 'data/menus.xml', - 'views/inherit_account_payment_views.xml', - 'views/inherit_account_invoice_views.xml', - 'wizard/hotel_wizard.xml', + 'views/inherited_account_payment_views.xml', + 'views/inherited_account_invoice_views.xml', 'wizard/checkinwizard.xml', 'wizard/massive_price_reservation_days.xml', 'wizard/folio_make_invoice_advance_views.xml', - 'views/hotel_sequence.xml', - 'views/hotel_report.xml', - 'views/report_hotel_management.xml', - 'views/currency_exchange.xml', - 'views/hotel_floor.xml', - 'views/hotel_folio.xml', - 'views/inherit_res_partner.xml', - # 'views/hotel_service_type.xml', - # 'views/hotel_service_line.xml', - 'views/hotel_room_type.xml', - 'views/hotel_room.xml', - # 'views/hotel_service.xml', - 'views/inherit_product_product.xml', - 'views/hotel_room_amenities_type.xml', - 'views/hotel_room_amenities.xml', + 'data/hotel_sequence.xml', + 'views/hotel_floor_views.xml', + 'views/hotel_folio_views.xml', + 'views/inherited_res_partner_views.xml', + 'views/hotel_room_type_views.xml', + 'views/hotel_room_views.xml', + 'views/hotel_room_type_class_views.xml', + 'views/general.xml', + 'views/inherited_product_template_views.xml', + 'views/hotel_room_amenities_type_views.xml', + 'views/hotel_room_amenities_views.xml', 'views/hotel_room_type_restriction_views.xml', 'views/hotel_room_type_restriction_item_views.xml', - 'views/hotel_reservation.xml', - # 'views/room_type_views.xml', - 'views/cardex.xml', - 'views/hotel_room_type_availability.xml', - # 'views/hotel_dashboard.xml', + 'views/hotel_reservation_views.xml', + 'views/hotel_room_closure_reason_views.xml', + 'views/hotel_board_service_views.xml', + 'views/hotel_checkin_partner_views.xml', + 'views/hotel_room_type_availability_views.xml', 'data/cron_jobs.xml', 'data/records.xml', 'data/email_template_cancel.xml', 'data/email_template_reserv.xml', 'data/email_template_exit.xml', + 'wizard/wizard_reservation.xml', ], - 'css': ['static/src/css/room_kanban.css'], - 'auto_install': False, 'installable': True } diff --git a/hotel/data/cron_jobs.xml b/hotel/data/cron_jobs.xml index 894fac0a9..1d8d701cc 100644 --- a/hotel/data/cron_jobs.xml +++ b/hotel/data/cron_jobs.xml @@ -3,20 +3,7 @@ - - Daily Plan - - - 1 - days - -1 - 0 - - - model.daily_plan() - - - + Inform Guest About Reservation Before 24 Hours 1 diff --git a/hotel/data/hotel-color.png b/hotel/data/hotel-color.png deleted file mode 100644 index 0e3644a50..000000000 Binary files a/hotel/data/hotel-color.png and /dev/null differ diff --git a/hotel/data/hotel-grey.png b/hotel/data/hotel-grey.png deleted file mode 100644 index 110e14614..000000000 Binary files a/hotel/data/hotel-grey.png and /dev/null differ diff --git a/hotel/data/hotel_data.xml b/hotel/data/hotel_data.xml index 00bd0816e..7861a5487 100644 --- a/hotel/data/hotel_data.xml +++ b/hotel/data/hotel_data.xml @@ -116,6 +116,7 @@ 25.00 3 - + diff --git a/hotel/views/hotel_sequence.xml b/hotel/data/hotel_sequence.xml similarity index 100% rename from hotel/views/hotel_sequence.xml rename to hotel/data/hotel_sequence.xml diff --git a/hotel/data/menus.xml b/hotel/data/menus.xml index 2274e43ca..bdf51467a 100644 --- a/hotel/data/menus.xml +++ b/hotel/data/menus.xml @@ -13,13 +13,15 @@ sequence="15" parent="hotel_management_menu" groups="hotel.group_hotel_user"/> - + + groups="hotel.group_hotel_manager" /> - + diff --git a/hotel/data/records.xml b/hotel/data/records.xml index b6ab9cbe3..87772c922 100644 --- a/hotel/data/records.xml +++ b/hotel/data/records.xml @@ -6,13 +6,13 @@ - + eval="('res.config.settings', 'default_pricelist_id', 1)"/> - + eval="('res.config.settings', 'default_restriction_id', 1)"/> -# 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 datetime, timedelta -from dateutil import tz -from openerp.tools import ( - DEFAULT_SERVER_DATETIME_FORMAT, - DEFAULT_SERVER_DATE_FORMAT) -from openerp import fields, _ -from openerp.exceptions import ValidationError - - -# Generate a 'datetime' object from 'str_date' string with 'dtformat' format. -def _generate_datetime(str_date, dtformat, stz=False): - ndate = False - try: - ndate = datetime.strptime(str_date, dtformat) - ndate = ndate.replace(tzinfo=tz.gettz(stz and str(stz) or 'UTC')) - except ValueError: - return False - - return ndate - - -# Try generate a 'datetime' object from 'str_date' string -# using all odoo formats -def get_datetime(str_date, dtformat=False, hours=True, end_day=False, - stz=False): - if dtformat: - date_dt = _generate_datetime(str_date, dtformat, stz=stz) - else: - date_dt = _generate_datetime( - str_date, - DEFAULT_SERVER_DATETIME_FORMAT, - stz=stz) - if not date_dt: - date_dt = _generate_datetime( - str_date, - DEFAULT_SERVER_DATE_FORMAT, - stz=stz) - - if date_dt: - if end_day: - date_dt = dt_no_hours(date_dt, end_day=True) - elif not hours: - date_dt = dt_no_hours(date_dt) - - return date_dt - - -# Compare two dates -def date_compare(str_date_a, str_date_b, hours=True): - date_dt_a = get_datetime(str_date_a) - date_dt_b = get_datetime(str_date_b) - - if not hours: - date_dt_a = dt_no_hours(date_dt_a) - date_dt_b = dt_no_hours(date_dt_b) - - return date_dt_a == date_dt_b - - -# Set hours to zero -def dt_no_hours(new_start_date_dt, end_day=False): - if not end_day: - return new_start_date_dt.replace(hour=0, minute=0, second=0, - microsecond=0) - else: - return new_start_date_dt.replace(hour=23, minute=59, second=59, - microsecond=999999) - - -# Get now 'datetime' object -def now(hours=False): - now_utc_dt = fields.datetime.now().replace(tzinfo=tz.tzutc()) - - if not hours: - now_utc_dt = now_utc_dt.replace(hour=0, minute=0, second=0, - microsecond=0) - - return now_utc_dt - - -# Get the difference in days between 'str_date_start' and 'str_date_end' -def date_diff(date_start, date_end, hours=True, stz=False): - if not isinstance(date_start, datetime): - date_start_dt = get_datetime(date_start, stz=stz) - else: - date_start_dt = date_start - if not isinstance(date_end, datetime): - date_end_dt = get_datetime(date_end, stz=stz) - else: - date_end_dt = date_end - - if not date_start_dt or not date_end_dt: - raise ValidationError(_("Invalid date. Can't compare it!")) - - if not hours: - date_start_dt = dt_no_hours(date_start_dt) - date_end_dt = dt_no_hours(date_end_dt) - - return abs((date_end_dt - date_start_dt).days) - - -# Get a new 'datetime' object from 'date_dt' usign the 'tz' timezone -def dt_as_timezone(date_dt, stz): - return date_dt.astimezone(tz.gettz(stz and str(stz) or 'UTC')) - - -# Generate a list of days start in 'cdate' -def generate_dates_list(cdate, - num_days, - outformat=DEFAULT_SERVER_DATE_FORMAT, stz=False): - ndate = get_datetime(cdate, stz=stz) if not isinstance(cdate, datetime) \ - else cdate - return [(ndate + timedelta(days=i)).strftime(outformat) - for i in range(0, num_days)] - - -# Check if 'str_date' is between 'str_start_date' and 'str_end_date' -# 0 Inside -# -1 'str_date' is before 'str_start_date' -# 1 'str_date' is after 'str_end_date' -def date_in(str_date, str_start_date, str_end_date, hours=True, stz=False): - if not isinstance(str_date, datetime): - date_dt = get_datetime(str_date, stz=stz) - else: - date_dt = str_date - if not isinstance(str_start_date, datetime): - date_start_dt = get_datetime(str_date_start, stz=stz) - else: - date_start_dt = str_start_date - if not isinstance(str_end_date, datetime): - date_end_dt = get_datetime(str_end_date, stz=stz) - else: - date_end_dt = str_end_date - - if not date_start_dt or not date_end_dt or not date_dt: - raise ValidationError(_("Invalid date. Can't compare it!")) - - if not hours: - date_start_dt = dt_no_hours(date_start_dt) - date_end_dt = dt_no_hours(date_end_dt) - - res = -2 - if date_dt >= date_start_dt and date_dt <= date_end_dt: - res = 0 - elif date_dt > date_end_dt: - res = 1 - elif date_dt < date_start_dt: - res = -1 - - return res - - -# Check if 'str_start_date_a' and 'str_start_date_b' -# is between 'str_start_date_b' and 'str_end_date_b' -# 0 Inside -# -1 'str_date' is before 'str_start_date' -# 1 'str_date' is after 'str_end_date' -def range_dates_in(str_start_date_a, - str_end_date_a, - str_start_date_b, - str_end_date_b, - hours=True, stz=False): - date_start_dt_a = get_datetime(str_start_date_a, stz=stz) - date_end_dt_a = get_datetime(str_end_date_a, stz=stz) - date_start_dt_b = get_datetime(str_start_date_b, stz=stz) - date_end_dt_b = get_datetime(str_end_date_b, stz=stz) - - if not date_start_dt_a or not date_end_dt_a \ - or not date_start_dt_b or not date_end_dt_b: - raise ValidationError(_("Invalid date. Can't compare it!")) - - if not hours: - date_start_dt_b = dt_no_hours(date_start_dt_b) - date_end_dt_b = dt_no_hours(date_end_dt_b) - - res = -2 - if date_start_dt_a >= date_start_dt_b and date_end_dt_a <= date_end_dt_b: - res = 0 - elif date_start_dt_a < date_start_dt_b \ - and date_end_dt_a >= date_start_dt_b: - res = -1 - elif date_start_dt_a <= date_end_dt_b and date_end_dt_a > date_end_dt_b: - res = 1 - - return res diff --git a/hotel/i18n/es.mo b/hotel/i18n/es.mo index fd94c1b4b..82b37f2a0 100644 Binary files a/hotel/i18n/es.mo and b/hotel/i18n/es.mo differ diff --git a/hotel/i18n/es.po b/hotel/i18n/es.po index 18b940d34..b895829d6 100644 --- a/hotel/i18n/es.po +++ b/hotel/i18n/es.po @@ -2999,13 +2999,13 @@ msgid "Action Needed" msgstr "Action Needed" #. module: hotel -#: model:ir.actions.act_window,name:hotel.action_cardex -msgid "Action cardex" +#: model:ir.actions.act_window,name:hotel.action_checkin_partner +msgid "Action checkin" msgstr "Acción Checkin" #. module: hotel -#: model:ir.actions.act_window,name:hotel.action_cardex_download -msgid "Action cardex download" +#: model:ir.actions.act_window,name:hotel.action_checkin_partner_download +msgid "Action checkin download" msgstr "Accción descarga de checkin" #. module: hotel @@ -3311,39 +3311,39 @@ msgid "Capacity:" msgstr "Capacidad:" #. module: hotel -#: model:ir.ui.menu,name:hotel.menu_cardex -msgid "Cardex" +#: model:ir.ui.menu,name:hotel.menu_checkin_partner +msgid "Checkin" msgstr "Checkin" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_hotel_folio_cardex_pending -#: model:ir.model.fields,field_description:hotel.field_hotel_folio_cardex_pending_num -#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_cardex_pending -msgid "Cardex Pending" +#: model:ir.model.fields,field_description:hotel.field_hotel_folio_checkin_partner_pending +#: model:ir.model.fields,field_description:hotel.field_hotel_folio_checkin_partner_pending_num +#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_checkin_partner_pending +msgid "Checkin Pending" msgstr "Checkin Pendientes" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_cardex_pending_num -msgid "Cardex Pending Num" +#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_checkin_partner_pending_num +msgid "Checkin Pending Num" msgstr "Nº de Checkin Pendientes" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_hotel_folio_cardex_count -#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_cardex_count -msgid "Cardex counter" +#: model:ir.model.fields,field_description:hotel.field_hotel_folio_checkin_partner_count +#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_checkin_partner_count +msgid "Checkin counter" msgstr "Contador de Checkin" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_checkin_wizard_cardex_ids -#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_cardex_ids -msgid "Cardex ids" +#: model:ir.model.fields,field_description:hotel.field_checkin_wizard_checkin_partner_ids +#: model:ir.model.fields,field_description:hotel.field_hotel_reservation_checkin_partner_ids +msgid "Checkin ids" msgstr "Checkin ids" #. module: hotel #: code:addons/hotel/models/hotel_folio.py:333 #: code:addons/hotel/models/hotel_reservation.py:359 #, python-format -msgid "Cardexs" +msgid "Checkins" msgstr "Checkin" #. module: hotel @@ -3483,7 +3483,7 @@ msgstr "Niños" #. module: hotel #: model:ir.ui.view,arch_db:hotel.checkin_wizard_form_2 -#: model:ir.ui.view,arch_db:hotel.view_tree_cardex +#: model:ir.ui.view,arch_db:hotel.view_tree_checkin_partner msgid "Client name" msgstr "Nombre de Cliente" @@ -3653,7 +3653,7 @@ msgid "Create invoice/bill" msgstr "Crear Factura/cuenta" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_create_uid +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_create_uid #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_create_uid #: model:ir.model.fields,field_description:hotel.field_currency_exchange_create_uid #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv_create_uid @@ -3682,7 +3682,7 @@ msgid "Created by" msgstr "Creado por" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_create_date +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_create_date #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_create_date #: model:ir.model.fields,field_description:hotel.field_currency_exchange_create_date #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv_create_date @@ -3926,13 +3926,13 @@ msgid "Delivery address for current sales order." msgstr "Dirección de entrega para el pedido de venta actual." #. module: hotel -#: code:addons/hotel/models/cardex.py:38 +#: code:addons/hotel/models/checkin.py:38 #, python-format msgid "Departure date (%s) is prior to arrival on %s" msgstr "La fecha de salida (%s) es anterior a la llegada el %s" #. module: hotel -#: code:addons/hotel/models/cardex.py:80 +#: code:addons/hotel/models/checkin.py:80 #, python-format msgid "Departure date, is prior to arrival. Check it now. %s" msgstr "La fecha de salida es anterior a la llegada. Revíselo ahora. %s" @@ -3999,7 +3999,7 @@ msgid "Discount Type" msgstr "Tipo de Descuento" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_display_name +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_display_name #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_display_name #: model:ir.model.fields,field_description:hotel.field_currency_exchange_display_name #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv_display_name @@ -4098,7 +4098,7 @@ msgid "Duration in Days" msgstr "Duración en días" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_checkin_wizard_email_cardex +#: model:ir.model.fields,field_description:hotel.field_checkin_wizard_email_checkin_partner #: model:ir.model.fields,field_description:hotel.field_hotel_folio_email #: model:ir.model.fields,field_description:hotel.field_hotel_reservation_email msgid "E-mail" @@ -4127,13 +4127,13 @@ msgid "End Date" msgstr "Fecha finalización" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_enter_date +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_enter_date #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_enter_date msgid "Enter date" msgstr "Fecha Entrada" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_exit_date +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_exit_date #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_exit_date msgid "Exit date" msgstr "Fecha Salida" @@ -4444,7 +4444,7 @@ msgstr "Nombre del Hotel" #. module: hotel #: model:ir.ui.view,arch_db:hotel.view_hotel_config_settings -msgid "Hotel Parity" +msgid "Hotel Default" msgstr "Emparejado" #. module: hotel @@ -4532,7 +4532,7 @@ msgid "Hotel services detail provide tocustomer and it will include in main Invo msgstr "Los detalles de servicios al cliente que se incluirán en la Factura principal." #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_id +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_id #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_id #: model:ir.model.fields,field_description:hotel.field_currency_exchange_id #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv_id @@ -4962,7 +4962,7 @@ msgid "Last Message Date" msgstr "Last Message Date" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex___last_update +#: model:ir.model.fields,field_description:hotel.field_checkin_partner___last_update #: model:ir.model.fields,field_description:hotel.field_checkin_wizard___last_update #: model:ir.model.fields,field_description:hotel.field_currency_exchange___last_update #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv___last_update @@ -4997,7 +4997,7 @@ msgid "Last Updated" msgstr "Actualizado el" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_write_uid +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_write_uid #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_write_uid #: model:ir.model.fields,field_description:hotel.field_currency_exchange_write_uid #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv_write_uid @@ -5026,7 +5026,7 @@ msgid "Last Updated by" msgstr "Última actualización de" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_write_date +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_write_date #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_write_date #: model:ir.model.fields,field_description:hotel.field_currency_exchange_write_date #: model:ir.model.fields,field_description:hotel.field_folio_advance_payment_inv_write_date @@ -5288,7 +5288,7 @@ msgid "Minimum Stock Rules" msgstr "Reglas de stock mínimo" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_checkin_wizard_mobile_cardex +#: model:ir.model.fields,field_description:hotel.field_checkin_wizard_mobile_checkin_partner #: model:ir.model.fields,field_description:hotel.field_hotel_folio_mobile #: model:ir.model.fields,field_description:hotel.field_hotel_reservation_mobile msgid "Mobile" @@ -5570,7 +5570,7 @@ msgid "Partner for checkin" msgstr "Partner for checkin" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_partner_id +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_partner_id #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_partner_id msgid "Partner id" msgstr "Id del cliente" @@ -5831,7 +5831,7 @@ msgid "Product Category" msgstr "Categoría de producto" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_hotel_config_settings_parity_pricelist_id +#: model:ir.model.fields,field_description:hotel.field_hotel_config_settings_default_pricelist_id msgid "Product Pricelist" msgstr "Lista de precios del producto" @@ -6089,7 +6089,7 @@ msgid "Reservation has no adults" msgstr "La reserva no tiene adultos" #. module: hotel -#: model:ir.model.fields,field_description:hotel.field_cardex_reservation_id +#: model:ir.model.fields,field_description:hotel.field_checkin_partner_reservation_id #: model:ir.model.fields,field_description:hotel.field_checkin_wizard_reservation_id msgid "Reservation id" msgstr "Reserva id" @@ -6163,7 +6163,7 @@ msgstr "Nombre del Plan de Restricciones" #. module: hotel #: selection:hotel.wizard.massive.changes,section:0 -#: model:ir.model.fields,field_description:hotel.field_hotel_config_settings_parity_restrictions_id +#: model:ir.model.fields,field_description:hotel.field_hotel_config_settings_default_restriction_id #: model:ir.ui.menu,name:hotel.reservation_restriction_menu #: model:ir.ui.view,arch_db:hotel.reservation_restriction_item_view_form #: model:ir.ui.view,arch_db:hotel.reservation_restriction_item_view_tree @@ -7477,8 +7477,8 @@ msgid "can't assign the same date to more than msgstr "no puede asignar la misma fecha a más de una habitación virtual" #. module: hotel -#: model:ir.model,name:hotel.model_cardex -msgid "cardex" +#: model:ir.model,name:hotel.model_checkin_partner +msgid "checkin" msgstr "checkin" #. module: hotel diff --git a/hotel/models/__init__.py b/hotel/models/__init__.py index 6b4eea4f4..84c6f0088 100644 --- a/hotel/models/__init__.py +++ b/hotel/models/__init__.py @@ -2,32 +2,29 @@ # Copyright 2018 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import currency_exchange -#~ from . import folio_room_line -from . import inherit_payment_return +from . import inherited_payment_return from . import hotel_floor from . import hotel_folio from . import hotel_reservation from . import hotel_room -from . import hotel_room_amenities -from . import hotel_room_amenities_type +from . import hotel_amenity +from . import hotel_amenity_type from . import hotel_room_type -# from . import hotel_service_line from . import hotel_service -# from . import hotel_service_type -from . import inherit_account_invoice -# from . import inherit_product_category -from . import inherit_product_product -from . import inherit_res_company -# from . import room_type -from . import inherit_account_payment +from . import inherited_account_invoice +from . import inherited_product_template +from . import inherited_res_company +from . import inherited_account_payment from . import hotel_room_type_restriction from . import hotel_room_type_restriction_item from . import hotel_reservation_line -from . import cardex +from . import hotel_checkin_partner from . import hotel_room_type_availability -from . import inherit_product_pricelist +from . import inherited_product_pricelist from . import res_config -from . import inherit_res_partner +from . import inherited_res_partner from . import inherited_mail_compose_message -#~ from . import hotel_dashboard +from . import hotel_room_type_class +from . import hotel_room_closure_reason +from . import hotel_service_line +from . import hotel_board_service diff --git a/hotel/models/cardex.py b/hotel/models/cardex.py deleted file mode 100644 index 6b23fd574..000000000 --- a/hotel/models/cardex.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2017 Dario Lodeiros -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import datetime -from openerp import models, fields, api, _ -from openerp.exceptions import except_orm, ValidationError - - -class Cardex(models.Model): - _name = 'cardex' - - # Validation for Departure date is after arrival date. - @api.constrains('exit_date') - def validation_dates(self): - if self.exit_date < self.enter_date: - raise models.ValidationError( - _('Departure date (%s) is prior to arrival on %s') % - (self.exit_date, self.enter_date)) - - def default_reservation_id(self): - if 'reservation_id' in self.env.context: - reservation = self.env['hotel.reservation'].search([ - ('id', '=', self.env.context['reservation_id']) - ]) - return reservation - return False - - def default_enter_date(self): - if 'reservation_id' in self.env.context: - reservation = self.env['hotel.reservation'].search([ - ('id', '=', self.env.context['reservation_id']) - ]) - return reservation.checkin - return False - - def default_exit_date(self): - if 'reservation_id' in self.env.context: - reservation = self.env['hotel.reservation'].search([ - ('id', '=', self.env.context['reservation_id']) - ]) - return reservation.checkout - return False - - def default_partner_id(self): - if 'reservation_id' in self.env.context: - reservation = self.env['hotel.reservation'].search([ - ('id', '=', self.env.context['reservation_id']) - ]) - return reservation.partner_id - return False - - @api.onchange('enter_date', 'exit_date') - def check_change_dates(self): - if self.exit_date <= self.enter_date: - date_1 = fields.Date.from_string(self.enter_date) - date_2 = date_1 + datetime.timedelta(days=1) - self.update({'exit_date': date_2, }) - raise ValidationError( - _('Departure date, is prior to arrival. Check it now. %s') % - (date_2)) - - partner_id = fields.Many2one('res.partner', default=default_partner_id, - required=True) - reservation_id = fields.Many2one( - 'hotel.reservation', - default=default_reservation_id, readonly=True) - enter_date = fields.Date(default=default_enter_date, required=True) - exit_date = fields.Date(default=default_exit_date, required=True) diff --git a/hotel/models/currency_exchange.py b/hotel/models/currency_exchange.py deleted file mode 100644 index a56341d8e..000000000 --- a/hotel/models/currency_exchange.py +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright 2018 Dario Lodeiros -# Copyright 2018 Alexandre Díaz -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from decimal import Decimal -import time -# For Python 3.0 and later -from urllib.request import urlopen -from openerp import models, fields, api, _ -from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT - - -class CurrencyExchangeRate(models.Model): - _name = "currency.exchange" - _description = "currency" - - name = fields.Char('Reg Number', readonly=True, default='New') - today_date = fields.Datetime('Date Ordered', - required=True, - default=(lambda *a: - time.strftime - (DEFAULT_SERVER_DATETIME_FORMAT))) - input_curr = fields.Many2one('res.currency', string='Input Currency', - track_visibility='always') - in_amount = fields.Float('Amount Taken', size=64, default=1.0) - out_curr = fields.Many2one('res.currency', string='Output Currency', - track_visibility='always') - out_amount = fields.Float('Subtotal', size=64) - folio_no = fields.Many2one('hotel.folio', 'Folio Number') - guest_name = fields.Many2one('res.partner', string='Guest Name') - room_number = fields.Char(string='Room Number') - state = fields.Selection([('draft', 'Draft'), ('done', 'Done'), - ('cancel', 'Cancel')], 'State', default='draft') - rate = fields.Float('Rate(per unit)', size=64) - hotel_id = fields.Many2one('stock.warehouse', 'Hotel Name') - type = fields.Selection([('cash', 'Cash')], 'Type', default='cash') - tax = fields.Selection([('2', '2%'), ('5', '5%'), ('10', '10%')], - 'Service Tax', default='2') - total = fields.Float('Amount Given') - - @api.model - def create(self, vals): - """ - Overrides orm create method. - @param self: The object pointer - @param vals: dictionary of fields value. - """ - if not vals: - vals = {} - if self._context is None: - self._context = {} - seq_obj = self.env['ir.sequence'] - vals['name'] = seq_obj.next_by_code('currency.exchange') or 'New' - return super(CurrencyExchangeRate, self).create(vals) - - @api.onchange('folio_no') - def get_folio_no(self): - ''' - When you change folio_no, based on that it will update - the guest_name,hotel_id and room_number as well - --------------------------------------------------------- - @param self: object pointer - ''' - for rec in self: - self.guest_name = False - self.hotel_id = False - self.room_number = False - if rec.folio_no and len(rec.folio_no.room_lines) != 0: - self.guest_name = rec.folio_no.partner_id.id - self.hotel_id = rec.folio_no.warehouse_id.id - self.room_number = rec.folio_no.room_lines[0].product_id.name - - @api.multi - def act_cur_done(self): - """ - This method is used to change the state - to done of the currency exchange - --------------------------------------- - @param self: object pointer - """ - self.write({'state': 'done'}) - return True - - @api.multi - def act_cur_cancel(self): - """ - This method is used to change the state - to cancel of the currency exchange - --------------------------------------- - @param self: object pointer - """ - self.write({'state': 'cancel'}) - return True - - @api.multi - def act_cur_cancel_draft(self): - """ - This method is used to change the state - to draft of the currency exchange - --------------------------------------- - @param self: object pointer - """ - self.write({'state': 'draft'}) - return True - - @api.model - def get_rate(self, a, b): - ''' - Calculate rate between two currency - ----------------------------------- - @param self: object pointer - ''' - try: - url = 'http://finance.yahoo.com/d/quotes.csv?s=%s%s=X&f=l1' % (a, - b) - rate = urllib2.urlopen(url).read().rstrip() - return Decimal(rate) - except: - return Decimal('-1.00') - - @api.onchange('input_curr', 'out_curr', 'in_amount') - def get_currency(self): - ''' - When you change input_curr, out_curr or in_amount - it will update the out_amount of the currency exchange - ------------------------------------------------------ - @param self: object pointer - ''' - self.out_amount = 0.0 - if self.input_curr: - for rec in self: - result = rec.get_rate(self.input_curr.name, - self.out_curr.name) - if self.out_curr: - self.rate = result - if self.rate == Decimal('-1.00'): - raise except_orm(_('Warning'), - _('Please Check Your \ - Network Connectivity.')) - self.out_amount = (float(result) * float(self.in_amount)) - - @api.onchange('out_amount', 'tax') - def tax_change(self): - ''' - When you change out_amount or tax - it will update the total of the currency exchange - ------------------------------------------------- - @param self: object pointer - ''' - if self.out_amount: - ser_tax = ((self.out_amount) * (float(self.tax))) / 100 - self.total = self.out_amount - ser_tax diff --git a/hotel/models/hotel_amenity.py b/hotel/models/hotel_amenity.py new file mode 100644 index 000000000..3198dfdae --- /dev/null +++ b/hotel/models/hotel_amenity.py @@ -0,0 +1,14 @@ +# Copyright 2017 Alexandre Díaz +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields + +class HotelRoomAmenitie(models.Model): + _name = 'hotel.amenity' + _description = 'Room amenities' + + name = fields.Char('Amenity Name', required=True) + active = fields.Boolean('Active', default=True) + default_code = fields.Char('Internal Reference') + room_amenity_type_id = fields.Many2one('hotel.amenity.type', + 'Amenity Catagory') diff --git a/hotel/models/hotel_amenity_type.py b/hotel/models/hotel_amenity_type.py new file mode 100644 index 000000000..466520036 --- /dev/null +++ b/hotel/models/hotel_amenity_type.py @@ -0,0 +1,15 @@ +# Copyright 2017 Alexandre Díaz +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields + + +class HotelRoomAmenitieType(models.Model): + _name = 'hotel.amenity.type' + _description = 'Amenities Type' + + name = fields.Char('Amenity Name', required=True) + active = fields.Boolean('Active', default=True) + room_amenity_ids = fields.One2many('hotel.amenity', + 'room_amenity_type_id', + 'Amenities in this category') diff --git a/hotel/models/hotel_board_service.py b/hotel/models/hotel_board_service.py new file mode 100644 index 000000000..c4774e4d7 --- /dev/null +++ b/hotel/models/hotel_board_service.py @@ -0,0 +1,15 @@ +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields + + +class HotelBoardService(models.Model): + _name = "hotel.board.service" + _description = "Board Services" + + name = fields.Char('Board Name', size=64, required=True, index=True) + service_ids = fields.Many2many(comodel_name='product.template', + relation='hotel_board_services_room', + column1='board_id', + column2='service_id') + sequence = fields.Integer('Sequence') diff --git a/hotel/models/hotel_checkin_partner.py b/hotel/models/hotel_checkin_partner.py new file mode 100644 index 000000000..6b5cbf3ff --- /dev/null +++ b/hotel/models/hotel_checkin_partner.py @@ -0,0 +1,74 @@ +# Copyright 2017 Dario Lodeiros +# Copyright 2018 Alexandre Diaz +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import datetime +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError + + +class HotelCheckinPartner(models.Model): + _name = 'hotel.checkin.partner' + + def _default_reservation_id(self): + if 'reservation_id' in self.env.context: + reservation = self.env['hotel.reservation'].browse([ + self.env.context['reservation_id'] + ]) + return reservation + return False + + def _default_enter_date(self): + if 'reservation_id' in self.env.context: + reservation = self.env['hotel.reservation'].browse([ + self.env.context['reservation_id'] + ]) + return reservation.checkin + return False + + def _default_exit_date(self): + if 'reservation_id' in self.env.context: + reservation = self.env['hotel.reservation'].browse([ + self.env.context['reservation_id'] + ]) + return reservation.checkout + return False + + def _default_partner_id(self): + if 'reservation_id' in self.env.context: + reservation = self.env['hotel.reservation'].browse([ + self.env.context['reservation_id'] + ]) + return reservation.partner_id + return False + + + partner_id = fields.Many2one('res.partner', default=_default_partner_id, + required=True) + reservation_id = fields.Many2one( + 'hotel.reservation', + default=_default_reservation_id, readonly=True) + enter_date = fields.Date(default=_default_enter_date, required=True) + exit_date = fields.Date(default=_default_exit_date, required=True) + + # Validation for Departure date is after arrival date. + @api.multi + @api.constrains('exit_date','enter_date') + def _check_exit_date(self): + for record in self: + date_in = fields.Date.from_string(record.enter_date) + date_out = fields.Date.from_string(record.exit_date) + if date_out < date_in: + raise models.ValidationError( + _('Departure date (%s) is prior to arrival on %s') % + (date_out, date_in)) + + @api.onchange('enter_date', 'exit_date') + def _onchange_enter_date(self): + date_in = fields.Date.from_string(self.enter_date) + date_out = fields.Date.from_string(self.exit_date) + if date_out <= date_in: + date_out = date_in + datetime.timedelta(days=1) + self.update({'exit_date': date_out}) + raise ValidationError( + _('Departure date, is prior to arrival. Check it now. %s') % + date_out) diff --git a/hotel/models/hotel_dashboard.py b/hotel/models/hotel_dashboard.py deleted file mode 100644 index 0208809ae..000000000 --- a/hotel/models/hotel_dashboard.py +++ /dev/null @@ -1,260 +0,0 @@ -# Copyright 2018 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import json -from datetime import datetime, timedelta -from babel.dates import format_datetime, format_date -from odoo import models, api, _, fields -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF -from odoo.tools.misc import formatLang - -class HotelDashboard(models.Model): - _name = "hotel.dashboard" - - # FIXME - def _get_count(self): - resevations_count = self.env['hotel.reservation'].search_count( - [('sate', '=', 'confirm')]) - folios_count = self.env['hotel.folio'].search_count( - [('sate', '=', 'sales_order')]) - next_arrivals_count = self.env['hotel.reservation'].search_count( - [('is_checkin', '=', True)]) - - self.orders_count = len(orders_count) - self.quotations_count = len(quotations_count) - self.orders_done_count = len(orders_done_count) - - @api.one - def _kanban_dashboard(self): - if self.graph_type == 'bar': - self.kanban_dashboard_graph = json.dumps(self.get_bar_graph_datas()) - elif self.graph_type == 'line': - self.kanban_dashboard_graph = json.dumps(self.get_line_graph_datas()) - - @api.one - def _kanban_dashboard_graph(self): - self.kanban_dashboard_graph = json.dumps(self.get_bar_graph_datas()) - #~ if (self.type in ['sale', 'purchase']): - #~ self.kanban_dashboard_graph = json.dumps(self.get_bar_graph_datas()) - #~ elif (self.type in ['cash', 'bank']): - #~ self.kanban_dashboard_graph = json.dumps(self.get_line_graph_datas()) - - color = fields.Integer(string='Color Index') - name = fields.Char(string="Name") - type = fields.Char(default="sale") - graph_type = fields.Selection([ - ('line', 'Line'), - ('bar', 'Bar'), - ('none', 'None')]) - reservations_count = fields.Integer(compute='_get_count') - folios_count = fields.Integer(compute='_get_count') - next_arrivals_count = fields.Integer(compute='_get_count') - kanban_dashboard = fields.Text(compute='_kanban_dashboard') - kanban_dashboard_graph = fields.Text(compute='_kanban_dashboard_graph') - show_on_dashboard = fields.Boolean( - string='Show journal on dashboard', - help="Whether this journal should be displayed on the dashboard or not", - default=True) - - @api.multi - def get_bar_graph_datas(self): - data = [] - today = datetime.strptime(fields.Date.context_today(self), DF) - day_of_week = int(format_datetime(today, 'e', locale=self._context.get('lang') or 'en_US')) - for i in range(0, 15): - if i == 0: - label = _('Today') - else: - label = format_date(today + timedelta(days=i), - 'd', - locale=self._context.get('lang') or 'en_US') - data.append({'label':label, 'value':0.0, 'type': 'past' if i < 0 else 'future'}) - # Build SQL query to find amount aggregated by week - select_sql_clause = """SELECT count(id) as total from hotel_reservation where state != 'cancelled'""" - query = "("+select_sql_clause+" and date(checkin) = '"+today.strftime(DF)+"')" - for i in range(1,15): - next_date = today + timedelta(days=i) - query += " UNION ALL ("+select_sql_clause+" and date(checkin) = '"+next_date.strftime(DF)+"')" - - self.env.cr.execute(query) - query_results = self.env.cr.dictfetchall() - for index_k, index_v in enumerate(query_results): - data[index_k]['value'] = index_v.get('total') - return [{'values': data}] - - @api.multi - def get_journal_dashboard_datas(self): - #~ currency = self.currency_id or self.company_id.currency_id - #~ number_to_reconcile = last_balance = account_sum = 0 - #~ ac_bnk_stmt = [] - #~ title = '' - #~ number_draft = number_waiting = number_late = 0 - #~ sum_draft = sum_waiting = sum_late = 0.0 - #~ if self.type in ['bank', 'cash']: - #~ last_bank_stmt = self.env['account.bank.statement'].search([('journal_id', 'in', self.ids)], order="date desc, id desc", limit=1) - #~ last_balance = last_bank_stmt and last_bank_stmt[0].balance_end or 0 - #~ #Get the number of items to reconcile for that bank journal - #~ self.env.cr.execute("""SELECT COUNT(DISTINCT(statement_line_id)) - #~ FROM account_move where statement_line_id - #~ IN (SELECT line.id - #~ FROM account_bank_statement_line AS line - #~ LEFT JOIN account_bank_statement AS st - #~ ON line.statement_id = st.id - #~ WHERE st.journal_id IN %s and st.state = 'open')""", (tuple(self.ids),)) - #~ already_reconciled = self.env.cr.fetchone()[0] - #~ self.env.cr.execute("""SELECT COUNT(line.id) - #~ FROM account_bank_statement_line AS line - #~ LEFT JOIN account_bank_statement AS st - #~ ON line.statement_id = st.id - #~ WHERE st.journal_id IN %s and st.state = 'open'""", (tuple(self.ids),)) - #~ all_lines = self.env.cr.fetchone()[0] - #~ number_to_reconcile = all_lines - already_reconciled - #~ # optimization to read sum of balance from account_move_line - #~ account_ids = tuple(filter(None, [self.default_debit_account_id.id, self.default_credit_account_id.id])) - #~ if account_ids: - #~ amount_field = 'balance' if (not self.currency_id or self.currency_id == self.company_id.currency_id) else 'amount_currency' - #~ query = """SELECT sum(%s) FROM account_move_line WHERE account_id in %%s AND date <= %%s;""" % (amount_field,) - #~ self.env.cr.execute(query, (account_ids, fields.Date.today(),)) - #~ query_results = self.env.cr.dictfetchall() - #~ if query_results and query_results[0].get('sum') != None: - #~ account_sum = query_results[0].get('sum') - #~ #TODO need to check if all invoices are in the same currency than the journal!!!! - #~ elif self.type in ['sale', 'purchase']: - #~ title = _('Bills to pay') if self.type == 'purchase' else _('Invoices owed to you') - #~ # optimization to find total and sum of invoice that are in draft, open state - #~ query = """SELECT state, amount_total, currency_id AS currency, type FROM account_invoice WHERE journal_id = %s AND state NOT IN ('paid', 'cancel');""" - #~ self.env.cr.execute(query, (self.id,)) - #~ query_results = self.env.cr.dictfetchall() - #~ today = datetime.today() - #~ query = """SELECT amount_total, currency_id AS currency, type FROM account_invoice WHERE journal_id = %s AND date < %s AND state = 'open';""" - #~ self.env.cr.execute(query, (self.id, today)) - #~ late_query_results = self.env.cr.dictfetchall() - #~ for result in query_results: - #~ if result['type'] in ['in_refund', 'out_refund']: - #~ factor = -1 - #~ else: - #~ factor = 1 - #~ cur = self.env['res.currency'].browse(result.get('currency')) - #~ if result.get('state') in ['draft', 'proforma', 'proforma2']: - #~ number_draft += 1 - #~ sum_draft += cur.compute(result.get('amount_total'), currency) * factor - #~ elif result.get('state') == 'open': - #~ number_waiting += 1 - #~ sum_waiting += cur.compute(result.get('amount_total'), currency) * factor - #~ for result in late_query_results: - #~ if result['type'] in ['in_refund', 'out_refund']: - #~ factor = -1 - #~ else: - #~ factor = 1 - #~ cur = self.env['res.currency'].browse(result.get('currency')) - #~ number_late += 1 - #~ sum_late += cur.compute(result.get('amount_total'), currency) * factor - - #~ difference = currency.round(last_balance-account_sum) + 0.0 - return { - 'graph': self.graph_type, - 'number_to_reconcile': 11, - 'account_balance': 4314, - 'last_balance': 252, - 'difference': 432, - 'number_draft': 32, - 'number_waiting': 44, - 'number_late': 23, - 'sum_draft': 2424245, - 'sum_waiting': 3124312, - 'sum_late': 23123, - 'currency_id': 1, - 'bank_statements_source': 'fonte', - 'title': 'titulo', - } - - @api.multi - def get_line_graph_datas(self): - data = [] - today = datetime.strptime(fields.Date.context_today(self), DF) - days=30 - - for i in range(-1, days + 1): - ndate = today + timedelta(days=i) - ndate_str = ndate.strftime(DF) - day_onboard = self.env['hotel.reservation.line'].search_count([('date','=',ndate)]) - locale = self._context.get('lang') or 'en_US' - short_name = format_date(ndate, 'd', locale=locale) - name = format_date(ndate, 'd LLLL Y', locale=locale) - data.append({'x':short_name,'y':day_onboard, 'name':name}) - return [{'values': data, 'area': True}] - - @api.multi - def action_create_new(self): - #~ ctx = self._context.copy() - #~ model = 'account.invoice' - #~ if self.type == 'sale': - #~ ctx.update({'journal_type': self.type, 'default_type': 'out_invoice', 'type': 'out_invoice', 'default_journal_id': self.id}) - #~ if ctx.get('refund'): - #~ ctx.update({'default_type':'out_refund', 'type':'out_refund'}) - #~ view_id = self.env.ref('account.invoice_form').id - #~ elif self.type == 'purchase': - #~ ctx.update({'journal_type': self.type, 'default_type': 'in_invoice', 'type': 'in_invoice', 'default_journal_id': self.id}) - #~ if ctx.get('refund'): - #~ ctx.update({'default_type': 'in_refund', 'type': 'in_refund'}) - #~ view_id = self.env.ref('account.invoice_supplier_form').id - #~ else: - #~ ctx.update({'default_journal_id': self.id}) - #~ view_id = self.env.ref('account.view_move_form').id - #~ model = 'account.move' - model = "hotel.folio" - view_id = self.env.ref('hotel.view_hotel_folio1_form').id - ctx='' - return { - 'name': _('Create invoice/bill'), - 'type': 'ir.actions.act_window', - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': model, - 'view_id': view_id, - 'context': ctx, - } - - @api.multi - def open_action(self): - """return action based on type for related journals""" - #~ action_name = self._context.get('action_name', False) - #~ if not action_name: - #~ if self.type == 'bank': - #~ action_name = 'action_bank_statement_tree' - #~ elif self.type == 'cash': - #~ action_name = 'action_view_bank_statement_tree' - #~ elif self.type == 'sale': - #~ action_name = 'action_invoice_tree1' - #~ elif self.type == 'purchase': - #~ action_name = 'action_invoice_tree2' - #~ else: - #~ action_name = 'action_move_journal_line' - - #~ _journal_invoice_type_map = { - #~ ('sale', None): 'out_invoice', - #~ ('purchase', None): 'in_invoice', - #~ ('sale', 'refund'): 'out_refund', - #~ ('purchase', 'refund'): 'in_refund', - #~ ('bank', None): 'bank', - #~ ('cash', None): 'cash', - #~ ('general', None): 'general', - #~ } - #~ invoice_type = _journal_invoice_type_map[(self.type, self._context.get('invoice_type'))] - - #~ ctx = self._context.copy() - #~ ctx.pop('group_by', None) - #~ ctx.update({ - #~ 'journal_type': self.type, - #~ 'default_journal_id': self.id, - #~ 'search_default_journal_id': self.id, - #~ 'default_type': invoice_type, - #~ 'type': invoice_type - #~ }) - - #~ [action] = self.env.ref('account.%s' % action_name).read() - #~ action['context'] = ctx - #~ action['domain'] = self._context.get('use_domain', []) - #~ if action_name in ['action_bank_statement_tree', 'action_view_bank_statement_tree']: - #~ action['views'] = False - #~ action['view_id'] = False - return False diff --git a/hotel/models/hotel_floor.py b/hotel/models/hotel_floor.py index 2bec212eb..2e1eae288 100644 --- a/hotel/models/hotel_floor.py +++ b/hotel/models/hotel_floor.py @@ -1,6 +1,6 @@ # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api, _ +from odoo import models, fields class HotelFloor(models.Model): @@ -8,4 +8,4 @@ class HotelFloor(models.Model): _description = "Ubication" name = fields.Char('Ubication Name', size=64, required=True, index=True) - sequence = fields.Integer('Sequence', size=64) + sequence = fields.Integer('Sequence') diff --git a/hotel/models/hotel_folio.py b/hotel/models/hotel_folio.py index 668106463..26f0c5c66 100644 --- a/hotel/models/hotel_folio.py +++ b/hotel/models/hotel_folio.py @@ -48,6 +48,7 @@ class HotelFolio(models.Model): default=lambda self: _('New')) partner_id = fields.Many2one('res.partner', track_visibility='onchange') + closure_reason_id = fields.Many2one('room.closure.reason') # partner_invoice_id = fields.Many2one('res.partner', # string='Invoice Address', # readonly=True, required=True, @@ -104,13 +105,11 @@ class HotelFolio(models.Model): string="Payments") booking_pending = fields.Integer('Booking pending', - compute='_compute_cardex_count') - cardex_count = fields.Integer('Cardex counter', - compute='_compute_cardex_count') - cardex_pending_count = fields.Integer('Cardex Pending', - compute='_compute_cardex_count') - checkins_reservations = fields.Integer('checkins reservations') - checkouts_reservations = fields.Integer('checkouts reservations') + compute='_compute_checkin_partner_count') + checkin_partner_count = fields.Integer('Checkin counter', + compute='_compute_checkin_partner_count') + checkin_partner_pending_count = fields.Integer('Checkin Pending', + compute='_compute_checkin_partner_count') partner_internal_comment = fields.Text(string='Internal Partner Notes', related='partner_id.comment') internal_comment = fields.Text(string='Internal Folio Notes') @@ -189,7 +188,7 @@ class HotelFolio(models.Model): self.ensure_one() partner = self.partner_id.id amount = self.pending_amount - view_id = self.env.ref('hotel.view_account_payment_folio_form').id + view_id = self.env.ref('hotel.account_payment_view_form_folio').id return{ 'name': _('Register Payment'), 'view_type': 'form', @@ -351,19 +350,13 @@ class HotelFolio(models.Model): #~ 'fiscal_position_id': False, #~ }) return - addr = self.partner_id.address_get(['invoice']) - #TEMP: - values = { 'user_id': self.partner_id.user_id.id or self.env.uid, - 'pricelist_id':self.partner_id.property_product_pricelist and \ - self.partner_id.property_product_pricelist.id or \ - self.env['ir.default'].sudo().get('res.config.settings', 'parity_pricelist_id')} - #~ values = { - #~ 'pricelist_id': self.partner_id.property_product_pricelist and \ - #~ self.partner_id.property_product_pricelist.id or False, - #~ 'partner_invoice_id': addr['invoice'], - #~ 'user_id': self.partner_id.user_id.id or self.env.uid - #~ } + pricelist = self.partner_id.property_product_pricelist and \ + self.partner_id.property_product_pricelist.id or \ + self.env['ir.default'].sudo().get('res.config.settings', 'default_pricelist_id') + values = {'user_id': self.partner_id.user_id.id or self.env.uid, + 'pricelist_id': pricelist + } if self.env['ir.config_parameter'].sudo().get_param('sale.use_sale_note') and \ self.env.user.company_id.sale_note: values['note'] = self.with_context( @@ -373,6 +366,24 @@ class HotelFolio(models.Model): values['team_id'] = self.partner_id.team_id.id self.update(values) + @api.multi + @api.onchange('pricelist_id') + def onchange_pricelist_id(self): + values = {'reservation_type': self.env['hotel.folio'].calcule_reservation_type( + self.pricelist_id.is_staff, + self.reservation_type)} + self.update(values) + + + @api.model + def calcule_reservation_type(self, is_staff, current_type): + if current_type == 'out': + return 'out' + elif is_staff: + return 'staff' + else: + return 'normal' + @api.multi def action_invoice_create(self, grouped=False, states=None): ''' @@ -454,54 +465,29 @@ class HotelFolio(models.Model): self.ensure_one() rooms = self.mapped('room_lines.id') return { - 'name': _('Cardexs'), + 'name': _('Checkins'), 'view_type': 'form', 'view_mode': 'tree,form', - 'res_model': 'cardex', + 'res_model': 'hotel.checkin.partner', 'type': 'ir.actions.act_window', 'domain': [('reservation_id', 'in', rooms)], 'target': 'new', } - @api.model - def daily_plan(self): - _logger.info('daily_plan') - self._cr.execute("update hotel_folio set checkins_reservations = 0, \ - checkouts_reservations = 0 where checkins_reservations > 0 \ - or checkouts_reservations > 0") - folios_in = self.env['hotel.folio'].search([ - ('room_lines.is_checkin', '=', True) - ]) - folios_out = self.env['hotel.folio'].search([ - ('room_lines.is_checkout', '=', True) - ]) - for fol in folios_in: - count_checkin = fol.room_lines.search_count([ - ('is_checkin', '=', True), ('folio_id.id', '=', fol.id) - ]) - fol.write({'checkins_reservations': count_checkin}) - for fol in folios_out: - count_checkout = fol.room_lines.search_count([ - ('is_checkout', '=', True), - ('folio_id.id', '=', fol.id) - ]) - fol.write({'checkouts_reservations': count_checkout}) - return True - @api.multi - def _compute_cardex_count(self): - _logger.info('_compute_cardex_amount') + def _compute_checkin_partner_count(self): + _logger.info('_compute_checkin_partner_amount') for record in self: if record.reservation_type == 'normal' and record.room_lines: write_vals = {} filtered_reservs = record.room_lines.filtered( lambda x: x.state != 'cancelled' and \ not x.parent_reservation) - mapped_cardex = filtered_reservs.mapped('cardex_ids.id') - record.cardex_count = len(mapped_cardex) - mapped_cardex_count = filtered_reservs.mapped( - lambda x: (x.adults + x.children) - len(x.cardex_ids)) - record.cardex_pending_count = sum(mapped_cardex_count) + mapped_checkin_partner = filtered_reservs.mapped('checkin_partner_ids.id') + record.checkin_partner_count = len(mapped_checkin_partner) + mapped_checkin_partner_count = filtered_reservs.mapped( + lambda x: (x.adults + x.children) - len(x.checkin_partner_ids)) + record.checkin_partner_pending_count = sum(mapped_checkin_partner_count) """ MAILING PROCESS diff --git a/hotel/models/hotel_reservation.py b/hotel/models/hotel_reservation.py index 094fe6179..2cc090865 100644 --- a/hotel/models/hotel_reservation.py +++ b/hotel/models/hotel_reservation.py @@ -11,7 +11,6 @@ from odoo.tools import ( DEFAULT_SERVER_DATETIME_FORMAT) from odoo import models, fields, api, _ from odoo.addons import decimal_precision as dp -from odoo.addons.hotel import date_utils _logger = logging.getLogger(__name__) @@ -159,6 +158,7 @@ class HotelReservation(models.Model): required=True, track_visibility='onchange') partner_id = fields.Many2one(related='folio_id.partner_id') + closure_reason_id = fields.Many2one(related='folio_id.closure_reason_id') company_id = fields.Many2one('res.company', 'Company') reservation_line_ids = fields.One2many('hotel.reservation.line', 'reservation_id', @@ -178,23 +178,22 @@ class HotelReservation(models.Model): pricelist_id = fields.Many2one('product.pricelist', related='folio_id.pricelist_id', readonly="1") - cardex_ids = fields.One2many('cardex', 'reservation_id') - # TODO: As cardex_count is a computed field, it can't not be used in a domain filer - # Non-stored field hotel.reservation.cardex_count cannot be searched + checkin_partner_ids = fields.One2many('hotel.checkin.partner', 'reservation_id') + # TODO: As checkin_partner_count is a computed field, it can't not be used in a domain filer + # Non-stored field hotel.reservation.checkin_partner_count cannot be searched # searching on a computed field can also be enabled by setting the search parameter. # The value is a method name returning a Domains - cardex_count = fields.Integer('Cardex counter', - compute='_compute_cardex_count') - cardex_pending_count = fields.Integer('Cardex Pending Num', - compute='_compute_cardex_count', - search='_search_cardex_pending') + checkin_partner_count = fields.Integer('Checkin counter', + compute='_compute_checkin_partner_count') + checkin_partner_pending_count = fields.Integer('Checkin Pending Num', + compute='_compute_checkin_partner_count', + search='_search_checkin_partner_pending') # check_rooms = fields.Boolean('Check Rooms') - is_checkin = fields.Boolean() - is_checkout = fields.Boolean() splitted = fields.Boolean('Splitted', default=False) parent_reservation = fields.Many2one('hotel.reservation', 'Parent Reservation') overbooking = fields.Boolean('Is Overbooking', default=False) + reselling = fields.Boolean('Is Reselling', default=False) nights = fields.Integer('Nights', compute='_computed_nights', store=True) channel_type = fields.Selection([ @@ -350,11 +349,12 @@ class HotelReservation(models.Model): @api.model def _autoassign(self, values): res = {} - checkin = values.get('checkin') + checkin = values.get('checkin') checkout = values.get('checkout') room_type = values.get('room_type_id') if checkin and checkout and room_type: room_chosen = self.env['hotel.room.type'].check_availability_room(checkin, checkout, room_type)[0] + # Check room_chosen exist res.update({ 'room_id': room_chosen.id }) @@ -407,6 +407,7 @@ class HotelReservation(models.Model): 'parent_reservation': self.parent_reservation.id, 'state': self.state, 'overbooking': self.overbooking, + 'reselling': self.reselling, 'price_unit': self.price_unit, 'splitted': self.splitted, # 'room_type_id': self.room_type_id.id, @@ -442,14 +443,27 @@ class HotelReservation(models.Model): @api.onchange('partner_id') def onchange_partner_id(self): - #TODO: Change parity pricelist by default pricelist - values = { - 'pricelist_id': self.partner_id.property_product_pricelist and \ + pricelist = self.partner_id.property_product_pricelist and \ self.partner_id.property_product_pricelist.id or \ - self.env['ir.default'].sudo().get('res.config.settings', 'parity_pricelist_id'), + self.env['ir.default'].sudo().get('res.config.settings', 'default_pricelist_id') + values = { + 'pricelist_id': pricelist, } self.update(values) + @api.multi + @api.onchange('pricelist_id') + def onchange_pricelist_id(self): + values = {'reservation_type': self.env['hotel.folio'].calcule_reservation_type( + self.pricelist_id.is_staff, + self.reservation_type)} + self.update(values) + + @api.onchange('reservation_type') + def assign_partner_company_on_out_service(self): + if self.reservation_type == 'out': + self.update({'partner_id': self.env.user.company_id.partner_id.id}) + # When we need to overwrite the prices even if they were already established @api.onchange('room_type_id', 'pricelist_id', 'reservation_type') def onchange_overwrite_price_by_day(self): @@ -498,7 +512,7 @@ class HotelReservation(models.Model): def onchange_room_availabiltiy_domain(self): self.ensure_one() if self.checkin and self.checkout: - if self.overbooking: + if self.overbooking or self.reselling: return occupied = self.env['hotel.reservation'].get_reservations( self.checkin, @@ -524,11 +538,6 @@ class HotelReservation(models.Model): def _generate_color(self): self.ensure_one() now_utc_dt = fields.Datetime.now() - # unused variables - # diff_checkin_now = date_utils.date_diff(now_utc_dt, self.checkin, - # hours=False) - # diff_checkout_now = date_utils.date_diff(now_utc_dt, self.checkout, - # hours=False) ir_values_obj = self.env['ir.default'] reserv_color = '#FFFFFF' @@ -628,15 +637,10 @@ class HotelReservation(models.Model): hotel_reserv_obj = self.env['hotel.reservation'] for record in self: vals = {} - if record.cardex_ids: + if record.checkin_partner_ids: vals.update({'state': 'booking'}) else: vals.update({'state': 'confirm'}) - if record.checkin_is_today(): - vals.update({'is_checkin': True}) - folio = hotel_folio_obj.browse(record.folio_id.id) - folio.checkins_reservations = folio.room_lines.search_count([ - ('folio_id', '=', folio.id), ('is_checkin', '=', True)]) record.write(vals) if record.splitted: @@ -669,14 +673,6 @@ class HotelReservation(models.Model): 'state': 'cancelled', 'discount': 100.0, }) - if record.checkin_is_today: - record.is_checkin = False - folio = self.env['hotel.folio'].browse(record.folio_id.id) - folio.checkins_reservations = folio.room_lines.search_count([ - ('folio_id', '=', folio.id), - ('is_checkin', '=', True) - ]) - if record.splitted: master_reservation = record.parent_reservation or record splitted_reservs = self.env['hotel.reservation'].search([ @@ -748,7 +744,7 @@ class HotelReservation(models.Model): if not vals: vals = {} pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'default_pricelist_id') #~ pricelist_id = vals.get('pricelist_id') or self.pricelist_id.id room_type_id = vals.get('room_type_id') or self.room_type_id.id product = self.env['hotel.room.type'].browse(room_type_id).product_id @@ -793,7 +789,7 @@ class HotelReservation(models.Model): partner = self.partner_id.id amount = min(self.amount_reservation, self.folio_pending_amount) note = self.folio_id.name + ' (' + self.name + ')' - view_id = self.env.ref('hotel.view_account_payment_folio_form').id + view_id = self.env.ref('hotel.account_payment_view_form_folio').id return{ 'name': _('Register Payment'), 'view_type': 'form', @@ -833,7 +829,8 @@ class HotelReservation(models.Model): domain = [('reservation_line_ids.date', '>=', dfrom), ('reservation_line_ids.date', '<', dto), ('state', '!=', 'cancelled'), - ('overbooking', '=', False)] + ('overbooking', '=', False), + ('reselling', '=', False),] return domain @api.model @@ -863,7 +860,7 @@ class HotelReservation(models.Model): return reservations_dates # TODO: Use default values on checkin /checkout is empty - @api.constrains('checkin', 'checkout', 'state', 'room_id', 'overbooking') + @api.constrains('checkin', 'checkout', 'state', 'room_id', 'overbooking', 'reselling') def check_dates(self): """ 1.-When date_order is less then checkin date or @@ -893,89 +890,33 @@ class HotelReservation(models.Model): """ @api.multi - def _compute_cardex_count(self): - _logger.info('_compute_cardex_count') + def _compute_checkin_partner_count(self): + _logger.info('_compute_checkin_partner_count') for record in self: - record.cardex_count = len(record.cardex_ids) - record.cardex_pending_count = (record.adults + record.children) \ - - len(record.cardex_ids) + record.checkin_partner_count = len(record.checkin_partner_ids) + record.checkin_partner_pending_count = (record.adults + record.children) \ + - len(record.checkin_partner_ids) # https://www.odoo.com/es_ES/forum/ayuda-1/question/calculated-fields-in-search-filter-possible-118501 @api.multi - def _search_cardex_pending(self, operator, value): + def _search_checkin_partner_pending(self, operator, value): self.ensure_one() - recs = self.search([]).filtered(lambda x: x.cardex_pending_count > 0) + recs = self.search([]).filtered(lambda x: x.checkin_partner_pending_count > 0) return [('id', 'in', [x.id for x in recs])] if recs else [] @api.multi def action_reservation_checkout(self): for record in self: record.state = 'done' - if record.checkout_is_today(): - record.is_checkout = False - folio = self.env['hotel.folio'].browse(self.folio_id.id) - folio.checkouts_reservations = folio.room_lines.search_count([ - ('folio_id', '=', folio.id), - ('is_checkout', '=', True) - ]) - - @api.model - def daily_plan(self): - _logger.info('daily_plan') - today_str = fields.Date.today() - yesterday_utc_dt = datetime.now() - timedelta(days=1) - yesterday_str = yesterday_utc_dt.strftime(DEFAULT_SERVER_DATE_FORMAT) - reservations_to_checkout = self.env['hotel.reservation'].search([ - ('state', 'not in', ['done']), - ('checkout', '<', today_str) - ]) - for res in reservations_to_checkout: - res.action_reservation_checkout() - - reservations = self.env['hotel.reservation'].search([ - ('reservation_line_ids.date', 'in', [today_str, yesterday_str]), - ('state', 'in', ['confirm', 'booking']) - ]) - self._cr.execute("update hotel_reservation set is_checkin = False, \ - is_checkout = False where is_checkin = True or \ - is_checkout = True") - checkins_res = reservations.filtered(lambda x: ( - x.state in ('confirm','draft') - and date_utils.date_compare(x.checkin, today_str, hours=False) - and x.reservation_type == 'normal')) - checkins_res.write({'is_checkin': True}) - checkouts_res = reservations.filtered(lambda x: ( - x.state not in ('done','cancelled') - and date_utils.date_compare(x.checkout, today_str, - hours=False) - and x.reservation_type == 'normal')) - checkouts_res.write({'is_checkout': True}) - self.env['hotel.folio'].daily_plan() - return True - - @api.model - def checkin_is_today(self): - self.ensure_one() - tz_hotel = self.env['ir.default'].sudo().get('res.config.settings', 'tz_hotel') - today = fields.Date.context_today(self.with_context(tz=tz_hotel)) - return self.checkin == today - - @api.model - def checkout_is_today(self): - self.ensure_one() - tz_hotel = self.env['ir.default'].sudo().get( - 'res.config.settings', 'tz_hotel') - today = fields.Date.context_today(self.with_context(tz=tz_hotel)) - return self.checkout == today @api.multi def action_checks(self): self.ensure_one() return { - 'name': _('Cardexs'), + 'name': _('Checkins'), 'view_type': 'form', 'view_mode': 'tree,form', - 'res_model': 'cardex', + 'res_model': 'hotel.checkin.partner', 'type': 'ir.actions.act_window', 'domain': [('reservation_id', '=', self.id)], 'target': 'new', diff --git a/hotel/models/hotel_room.py b/hotel/models/hotel_room.py index d41608483..c4896cc2e 100644 --- a/hotel/models/hotel_room.py +++ b/hotel/models/hotel_room.py @@ -1,5 +1,6 @@ # Copyright 2017 Alexandre Díaz # Copyright 2017 Dario Lodeiros +# Copyright 2018 Pablo Quesada # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, fields, api, _ from odoo.exceptions import ValidationError @@ -18,11 +19,6 @@ class HotelRoom(models.Model): room_type_id = fields.Many2one('hotel.room.type', 'Hotel Room Type') floor_id = fields.Many2one('hotel.floor', 'Ubication', help='At which floor the room is located.') - # TODO Q. Should the amenities be on the Room Type ? - - room_amenities = fields.Many2many('hotel.room.amenities', 'temp_tab', - 'room_amenities', 'rcateg_id', - string='Room Amenities', - help='List of room amenities.') max_adult = fields.Integer('Max Adult') max_child = fields.Integer('Max Child') capacity = fields.Integer('Capacity') diff --git a/hotel/models/hotel_room_amenities.py b/hotel/models/hotel_room_amenities.py deleted file mode 100644 index dc0ce906a..000000000 --- a/hotel/models/hotel_room_amenities.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2017 Alexandre Díaz -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields, api, _ - - -class HotelRoomAmenities(models.Model): - _name = 'hotel.room.amenities' - _description = 'Room amenities' - - # The record's name - name = fields.Char('Amenity Name', required=True) - # Used for activate records - active = fields.Boolean('Active', default=True) - - default_code = fields.Char('Internal Reference', store=True) - - # room_categ_id = fields.Many2one('product.product', 'Product Category', - # required=True, delegate=True, - # ondelete='cascade') - room_amenities_type_id = fields.Many2one('hotel.room.amenities.type', - 'Amenity Catagory') - - # room_ids = fields.Many2man('hotel.room','Rooms') - - # @api.multi - # def unlink(self): - # # self.room_categ_id.unlink() - # return super(HotelRoomAmenities, self).unlink() diff --git a/hotel/models/hotel_room_amenities_type.py b/hotel/models/hotel_room_amenities_type.py deleted file mode 100644 index 4cc3d32ff..000000000 --- a/hotel/models/hotel_room_amenities_type.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2017 Alexandre Díaz -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields, api, _ - - -class HotelRoomAmenitiesType(models.Model): - _name = 'hotel.room.amenities.type' - _description = 'Amenities Type' - - # The record's name - name = fields.Char('Amenity Name', required=True) - # Used for activate records - active = fields.Boolean('Active', default=True) - - room_amenities_ids = fields.One2many('hotel.room.amenities', - 'room_amenities_type_id', - 'Amenities in this category') - - # cat_id = fields.Many2one('product.category', 'category', required=True, - # delegate=True, ondelete='cascade') - - # @api.multi - # def unlink(self): - # # self.cat_id.unlink() - # return super(HotelRoomAmenitiesType, self).unlink() diff --git a/hotel/models/hotel_room_closure_reason.py b/hotel/models/hotel_room_closure_reason.py new file mode 100644 index 000000000..2143ea194 --- /dev/null +++ b/hotel/models/hotel_room_closure_reason.py @@ -0,0 +1,10 @@ +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields + +class RoomClosureReason(models.Model): + _name = "room.closure.reason" + _description = "Cause of out of service" + + name = fields.Char('Name', required=True) + description = fields.Text('Description') diff --git a/hotel/models/hotel_room_type.py b/hotel/models/hotel_room_type.py index 7dcd4abe0..759f94d2d 100644 --- a/hotel/models/hotel_room_type.py +++ b/hotel/models/hotel_room_type.py @@ -5,7 +5,7 @@ from odoo import models, fields, api class HotelRoomType(models.Model): """ Before creating a 'room type', you need to consider the following: - With the term 'room type' is meant a type of residential accommodation: for + With the term 'room type' is meant a sales type of residential accommodation: for example, a Double Room, a Economic Room, an Apartment, a Tent, a Caravan... """ _name = "hotel.room.type" @@ -17,6 +17,12 @@ class HotelRoomType(models.Model): required=True, delegate=True, ondelete='cascade') room_ids = fields.One2many('hotel.room', 'room_type_id', 'Rooms') + class_id = fields.Many2one('hotel.room.type.class', 'Hotel Type Class') + room_amenity_ids = fields.Many2many('hotel.amenity', + 'hotel_room_type_aminity_rel', + 'room_type_ids', 'amenity_ids', + string='Room Type Amenities', + help='List of Amenities.') # TODO Hierarchical relationship for parent-child tree ? # parent_id = fields.Many2one ... diff --git a/hotel/models/hotel_room_type_availability.py b/hotel/models/hotel_room_type_availability.py index b17fa56f6..e15c600c9 100644 --- a/hotel/models/hotel_room_type_availability.py +++ b/hotel/models/hotel_room_type_availability.py @@ -1,25 +1,17 @@ # Copyright 2017 Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging from odoo import models, fields, api, _ from odoo.exceptions import ValidationError -_logger = logging.getLogger(__name__) class HotelRoomTypeAvailability(models.Model): - _inherit = 'mail.thread' _name = 'hotel.room.type.availability' + _inherit = 'mail.thread' - # room_type_id = fields.Many2one('hotel.virtual.room', 'Virtual Room', - # required=True, track_visibility='always', - # ondelete='cascade') room_type_id = fields.Many2one('hotel.room.type', 'Room Type', required=True, track_visibility='always', ondelete='cascade') avail = fields.Integer('Avail', default=0, track_visibility='always') - no_ota = fields.Boolean('No OTA', default=False, track_visibility='always') - booked = fields.Boolean('Booked', default=False, readonly=True, - track_visibility='always') date = fields.Date('Date', required=True, track_visibility='always') _sql_constraints = [ @@ -30,25 +22,15 @@ class HotelRoomTypeAvailability(models.Model): @api.constrains('avail') def _check_avail(self): - if self.avail < 0: - self.avail = 0 - - room_type_obj = self.env['hotel.room.type'] - cavail = len(room_type_obj.check_availability_room( - self.date, - self.date, - room_type_id=self.room_type_id.id)) - max_avail = min(cavail, - self.room_type_id.total_rooms_count) - if self.avail > max_avail: - self.avail = max_avail - - @api.constrains('date', 'room_type_id') - def _check_date_room_type_id(self): - count = self.search_count([ - ('date', '=', self.date), - ('room_type_id', '=', self.room_type_id.id) - ]) - if count > 1: - raise ValidationError(_("can't assign the same date to more than \ - one room type")) + for record in self: + if record.avail < 0: + record.avail = 0 + else: + room_type_obj = self.env['hotel.room.type'] + cavail = len(room_type_obj.check_availability_room( + record.date, + record.date, + room_type_id=record.room_type_id.id)) + max_avail = min(cavail, record.room_type_id.total_rooms_count) + if record.avail > max_avail: + record.avail = max_avail diff --git a/hotel/models/hotel_room_type_class.py b/hotel/models/hotel_room_type_class.py new file mode 100644 index 000000000..a5b1a6f53 --- /dev/null +++ b/hotel/models/hotel_room_type_class.py @@ -0,0 +1,25 @@ +# Copyright 2017 Alexandre Díaz +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields + +class HotelRoomTypeClass(models.Model): + """ Before creating a 'room type_class', you need to consider the following: + With the term 'room type class' is meant a physicial class of + residential accommodation: for example, a Room, a Bed, an Apartment, + a Tent, a Caravan... + """ + _name = "hotel.room.type.class" + _description = "Room Type Class" + _order = "sequence, name, code_class" + + name = fields.Char('Class Name', required=True, translate=True) + room_type_ids = fields.One2many('hotel.room.type', 'class_id', 'Types') + active = fields.Boolean('Active', default=True, + help="The active field allows you to hide the \ + category without removing it.") + sequence = fields.Integer('Sequence', default=0) + code_class = fields.Char('Code') + + _sql_constraints = [('code_class_unique', 'unique(code_class)', + 'code must be unique!')] diff --git a/hotel/models/hotel_room_type_restriction.py b/hotel/models/hotel_room_type_restriction.py index a11ec7d56..cdeb3985f 100644 --- a/hotel/models/hotel_room_type_restriction.py +++ b/hotel/models/hotel_room_type_restriction.py @@ -19,13 +19,13 @@ class HotelRoomTypeRestriction(models.Model): @api.depends('name') def name_get(self): restriction_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') + 'res.config.settings', 'default_restriction_id') if restriction_id: restriction_id = int(restriction_id) names = [] for record in self: if record.id == restriction_id: - names.append((record.id, '%s (Parity)' % record.name)) + names.append((record.id, '%s (Default)' % record.name)) else: names.append((record.id, record.name)) return names diff --git a/hotel/models/hotel_room_type_restriction_item.py b/hotel/models/hotel_room_type_restriction_item.py index 5da342f08..fd82480b5 100644 --- a/hotel/models/hotel_room_type_restriction_item.py +++ b/hotel/models/hotel_room_type_restriction_item.py @@ -1,9 +1,7 @@ # Copyright 2017 Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from datetime import datetime from odoo import models, fields, api, _ from odoo.exceptions import ValidationError -from odoo.tools import DEFAULT_SERVER_DATE_FORMAT class HotelRoomTypeRestrictionItem(models.Model): @@ -12,18 +10,9 @@ class HotelRoomTypeRestrictionItem(models.Model): restriction_id = fields.Many2one('hotel.room.type.restriction', 'Restriction Plan', ondelete='cascade', index=True) - # room_type_id = fields.Many2one('hotel.virtual.room', 'Virtual Room', - # required=True, ondelete='cascade') room_type_id = fields.Many2one('hotel.room.type', 'Room Type', required=True, ondelete='cascade') date = fields.Date('Date') - applied_on = fields.Selection([ - ('1_global', 'Global'), - # ('0_room_type', 'Virtual Room')], string="Apply On", required=True, - # default='0_room_type', - ('0_room_type', 'Room Type')], string="Apply On", required=True, - default='0_room_type', - help='Pricelist Item applicable on selected option') min_stay = fields.Integer("Min. Stay") min_stay_arrival = fields.Integer("Min. Stay Arrival") @@ -37,22 +26,19 @@ class HotelRoomTypeRestrictionItem(models.Model): 'unique(restriction_id, room_type_id, date)', 'Only can exists one restriction in the same day for the same room type!')] + @api.multi @api.constrains('min_stay', 'min_stay_arrival', 'max_stay', 'max_stay_arrival') - def _check_min_stay_min_stay_arrival_max_stay(self): - if self.min_stay < 0: - raise ValidationError(_("Min. Stay can't be less than zero")) - elif self.min_stay_arrival < 0: - raise ValidationError( - ("Min. Stay Arrival can't be less than zero")) - elif self.max_stay < 0: - raise ValidationError(_("Max. Stay can't be less than zero")) - elif self.max_stay_arrival < 0: - raise ValidationError( - ("Max. Stay Arrival can't be less than zero")) + def _check_min_stay(self): + for record in self: + if record.self.min_stay < 0: + raise ValidationError(_("Min. Stay can't be less than zero")) + elif record.min_stay_arrival < 0: + raise ValidationError( + ("Min. Stay Arrival can't be less than zero")) + elif record.max_stay < 0: + raise ValidationError(_("Max. Stay can't be less than zero")) + elif record.max_stay_arrival < 0: + raise ValidationError( + ("Max. Stay Arrival can't be less than zero")) - @api.constrains('applied_on') - def _check_applied_on(self): - count = self.search_count([('applied_on', '=', '1_global')]) - if count > 1: - raise ValidationError(_("Already exists an global rule")) diff --git a/hotel/models/hotel_service.py b/hotel/models/hotel_service.py index 7352702db..23c434e88 100644 --- a/hotel/models/hotel_service.py +++ b/hotel/models/hotel_service.py @@ -1,74 +1,123 @@ # Copyright 2017 Alexandre Díaz # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import time -import logging from odoo import models, fields, api -from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT -_logger = logging.getLogger(__name__) +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT +from datetime import timedelta class HotelService(models.Model): _name = 'hotel.service' _description = 'Hotel Services and its charges' - - @api.model - def _service_checkin(self): - if 'checkin' in self._context: - return self._context['checkin'] - return time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - - @api.model - def _service_checkout(self): - if 'checkout' in self._context: - return self._context['checkout'] - return time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) @api.model def _default_ser_room_line(self): - if 'room_lines' in self.env.context and self.env.context['room_lines']: + if self.env.context.get('room_lines'): ids = [item[1] for item in self.env.context['room_lines']] - return self.env['hotel.reservation'].search([ - ('id', 'in', ids), - ], limit=1) + return self.env['hotel.reservation'].browse([ + (ids)], limit=1) return False name = fields.Char('Service description') - # services in the hotel are products product_id = fields.Many2one('product.product', 'Service', required=True) - folio_id = fields.Many2one('hotel.folio', 'Folio', ondelete='cascade') - ser_room_line = fields.Many2one('hotel.reservation', 'Room', default=_default_ser_room_line) - - list_price = fields.Float( - related='product_id.list_price') - + service_line_ids = fields.One2many('hotel.service.line', 'service_id') + product_qty = fields.Integer('Quantity') + pricelist_id = fields.Many2one(related='folio_id.pricelist_id') channel_type = fields.Selection([ ('door', 'Door'), ('mail', 'Mail'), ('phone', 'Phone'), ('call', 'Call Center'), ('web', 'Web')], 'Sales Channel') + currency_id = fields.Many2one('res.currency', + related='pricelist_id.currency_id', + string='Currency', readonly=True, required=True) + price_subtotal = fields.Monetary(string='Subtotal', + readonly=True, + store=True, + compute='_compute_amount_reservation') + price_total = fields.Monetary(string='Total', + readonly=True, + store=True, + compute='_compute_amount_reservation') + price_tax = fields.Float(string='Taxes', + readonly=True, + store=True, + compute='_compute_amount_reservation') - ser_checkin = fields.Datetime('From Date', required=True, - default=_service_checkin) - ser_checkout = fields.Datetime('To Date', required=True, - default=_service_checkout) + @api.onchange('product_id') + def onchange_product_calc_qty(self): + """ + Compute the default quantity according to the + configuration of the selected product + """ + for record in self: + product = record.product_id + reservation = record.ser_room_line + if product and reservation: + qty = 1 + if product.per_day: + qty = qty * reservation.nights + if product.per_person: + qty = qty * (reservation.adults + reservation.children) + record.product_qty = qty + @api.onchange('product_qty') + def onchange_product_qty_days_selection(self): + """ + Try to calculate the days on which the product + should be served as long as the product is per day + """ + for record in self: + reservation = record.ser_room_line + if record.product_id.per_day: + days_diff = ( + fields.Date.from_string(reservation.checkout) - fields.Date.from_string(reservation.checkin) + ).days + record.update(record.prepare_service_lines( + reservation.checkin, + days_diff)) + else: + record.update(record.prepare_service_lines( + reservation.checkin, 1)) + + ##WIP## + @api.multi + def prepare_service_lines(self, dfrom, days, vals=False): + self.ensure_one() + old_qty = 0 + cmds = [(5, 0, 0)] + old_lines_days = self.mapped('service_line_ids.date') + for day in self.service_line_ids: + old_qty = old_qty + day.day_qty + qty_day = (self.product_qty - old_qty) // (days - len(old_line_days)) + rest_day = (self.product_qty - old_qty) % (days - len(old_line_days)) + for i in range(0, days): + idate = (fields.Date.from_string(dfrom) + timedelta(days=i)).strftime( + DEFAULT_SERVER_DATE_FORMAT) + old_line = self.service_line_ids.filtered(lambda r: r.date == idate) + if idate not in old_lines_days: + cmds.append((0, False, { + 'date': idate, + 'day_qty': qty_day + })) + else: + cmds.append((4, old_line.id)) + return {'service_line_ids': cmds} - # TODO Hierarchical relationship for parent-child tree - # parent_id = fields.Many2one ... - - # service_id = fields.Many2one('product.product', 'Service_id', - # required=True, ondelete='cascade', - # delegate=True) - # service_type_id = fields.Many2one('hotel.service.type', - # 'Service Catagory') - # service_line_id = fields.Many2one('hotel.service.line', - # 'Service Line') - # @api.multi - # def unlink(self): - # # for record in self: - # # record.service_id.unlink() - # return super(HotelServices, self).unlink() + @api.depends('qty_product', 'tax_id') + def _compute_amount_service(self): + """ + Compute the amounts of the service line. + """ + for record in self: + product = record.product_id + price = amount_room * (1 - (record.discount or 0.0) * 0.01) + taxes = record.tax_id.compute_all(price, record.currency_id, 1, product=product) + record.update({ + 'price_tax': sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])), + 'price_total': taxes['total_included'], + 'price_subtotal': taxes['total_excluded'], + }) diff --git a/hotel/models/hotel_service_line.py b/hotel/models/hotel_service_line.py index 0a7d42093..0e5a2e978 100644 --- a/hotel/models/hotel_service_line.py +++ b/hotel/models/hotel_service_line.py @@ -1,243 +1,32 @@ -# Copyright 2017 Alexandre Díaz +# Copyright 2017-2018 Alexandre Díaz # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import time -import logging from odoo import models, fields, api, _ -from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT -from odoo.exceptions import UserError -_logger = logging.getLogger(__name__) - -from odoo.addons import decimal_precision as dp - +from odoo.exceptions import ValidationError class HotelServiceLine(models.Model): - _name = 'hotel.service.line' - _description = 'hotel Service line' + _name = "hotel.service.line" + _order = "date" - @api.one - def copy(self, default=None): - ''' - @param self: object pointer - @param default: dict of default values to be set - ''' - line_id = self.service_line_id.id - sale_line_obj = self.env['sale.order.line'].browse(line_id) - return sale_line_obj.copy(default=default) + service_id = fields.Many2one('hotel.service', string='Service', + ondelete='cascade', required=True, + copy=False) + date = fields.Date('Date') + day_qty = fields.Integer('Units') + product_id = fields.Many2one(related='service_id.product_id') - @api.multi - def _amount_line(self, field_name, arg): - ''' - @param self: object pointer - @param field_name: Names of fields. - @param arg: User defined arguments - ''' - total_amount = 0 + @api.constrains('day_qty') + def no_free_resources(self): for record in self: - line = record.service_line_id - total_amount += line._amount_line(field_name, arg) - return total_amount + limit = record.product_id.daily_limit + if limit > 0: + out_qty = sum(self.env['hotel.service.line'].search([( + 'product_id', '=', record.product_id, + 'date', '=', record.date)]).mapped('day_qty')) + if limit < out_qty + record.day_qty: + raise ValidationError( + _("Limit exceeded for %s")% record.date) + - @api.multi - def _number_packages(self, field_name, arg): - ''' - @param self: object pointer - @param field_name: Names of fields. - @param arg: User defined arguments - ''' - total_packages = 0 - for record in self: - line = record.service_line_id - total_packages = line._number_packages(field_name, arg) - return total_packages - - @api.model - def _service_checkin(self): - if 'checkin' in self._context: - return self._context['checkin'] - return time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - - @api.model - def _service_checkout(self): - if 'checkout' in self._context: - return self._context['checkout'] - return time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - - @api.model - def _default_ser_room_line(self): - if 'room_lines' in self.env.context and self.env.context['room_lines']: - ids = [item[1] for item in self.env.context['room_lines']] - return self.env['hotel.reservation'].search([('id', 'in', ids)], - limit=1) - return False - - # The record's name - name = fields.Char('Service line', required=True) - # services in the hotel are products - product_id = fields.Many2one('product.product', 'Service') - - list_price = fields.Float( - related='product_id.list_price') - - # TODO refactor to services_ids - # services_line_id = fields.Many2one('hotel.services', 'Service Line', - # ondelete='cascade') - # FIXME You can add services to a folio ? - folio_id = fields.Many2one('hotel.folio', 'Folio', ondelete='cascade') - - channel_type = fields.Selection([ - ('door', 'Door'), - ('mail', 'Mail'), - ('phone', 'Phone'), - ('call', 'Call Center'), - ('web', 'Web')], 'Sales Channel') - - ser_checkin = fields.Date('From Date', required=True, - default=_service_checkin) - ser_checkout = fields.Date('To Date', required=True, - default=_service_checkout) - ser_room_line = fields.Many2one('hotel.reservation', 'Room', - default=_default_ser_room_line) - - @api.model - def create(self, vals): - """ - Overrides orm create method. - @param self: The object pointer - @param vals: dictionary of fields value. - @return: new record set for hotel service line. - """ - if 'folio_id' in vals: - folio = self.env['hotel.folio'].browse(vals['folio_id']) - vals.update({'order_id': folio.order_id.id}) - user = self.env['res.users'].browse(self.env.uid) - if user.has_group('hotel.group_hotel_call'): - vals.update({'channel_type': 'call'}) - return super(HotelServiceLine, self).create(vals) - - # ~ @api.multi - # ~ def unlink(self): - # ~ """ - # ~ Overrides orm unlink method. - # ~ @param self: The object pointer - # ~ @return: True/False. - # ~ """ - # ~ s_line_obj = self.env['sale.order.line'] - # ~ for line in self: - # ~ if line.service_line_id: - # ~ sale_unlink_obj = s_line_obj.browse([line.service_line_id.id]) - # ~ sale_unlink_obj.unlink() - # ~ return super(HotelServiceLine, self).unlink() - - @api.onchange('product_id') - def product_id_change_hotel(self): - ''' - @param self: object pointer - ''' - if self.product_id: - write_vals = {} - if not (self.folio_id and self.folio_id.partner_id) and \ - self.ser_room_line: - write_vals.update({'folio_id': self.ser_room_line.folio_id.id}) - write_vals.update({ - 'name': self.product_id.name, - 'price_unit': self.product_id.lst_price, - 'product_uom': self.product_id.uom_id, - 'price_unit': self.product_id.price, - }) - self.update(write_vals) - - #~ self.price_unit = tax_obj._fix_tax_included_price(prod.price, - #~ prod.taxes_id, - #~ self.tax_id) - - # ~ _logger.info(self._context) - # ~ if 'folio_id' in self._context: - # ~ _logger.info(self._context) - # ~ domain_rooms = [] - # ~ rooms_lines = self.env['hotel.reservation'].search([('folio_id','=',folio_id)]) - # ~ room_ids = room_lines.mapped('id') - # ~ domain_rooms.append(('id','in',room_ids)) - # ~ return {'domain': {'ser_room_line': domain_rooms}} - # - # ~ @api.onchange('folio_id') - # ~ def folio_id_change(self): - # ~ self.ensure_one() - # ~ _logger.info(self.mapped('folio_id.room_lines')) - # ~ rooms = self.mapped('folio_id.room_lines.id') - # ~ return {'domain': {'ser_room_line': rooms}} - - #~ @api.onchange('product_uom') - #~ def product_uom_change(self): - #~ ''' - #~ @param self: object pointer - #~ ''' - # ~ if not self.product_uom: - # ~ self.price_unit = 0.0 - # ~ return - # ~ self.price_unit = self.product_id.lst_price - # ~ if self.folio_id.partner_id: - # ~ prod = self.product_id.with_context( - # ~ lang=self.folio_id.partner_id.lang, - # ~ partner=self.folio_id.partner_id.id, - # ~ quantity=1, - # ~ date_order=self.folio_id.date_order, - # ~ pricelist=self.folio_id.pricelist_id.id, - # ~ uom=self.product_uom.id - # ~ ) - # ~ tax_obj = self.env['account.tax'] - # ~ self.price_unit = tax_obj._fix_tax_included_price(prod.price, - # ~ prod.taxes_id, - # ~ self.tax_id) - - @api.onchange('ser_checkin', 'ser_checkout') - def on_change_checkout(self): - ''' - When you change checkin or checkout it will checked it - and update the qty of hotel service line - ----------------------------------------------------------------- - @param self: object pointer - ''' - now_utc = fields.Date.today() - if not self.ser_checkin: - self.ser_checkin = now_utc - if not self.ser_checkout: - self.ser_checkout = now_utc - chkin_utc_dt = fields.Date.from_string(self.ser_checkin) - chkout_utc_dt = fields.Date.from_string(self.ser_checkout) - if chkout_utc_dt < chkin_utc_dt: - raise UserError(_('Checkout must be greater or equal checkin date')) - if self.ser_checkin and self.ser_checkout: - diffDate = abs((self.ser_checkout - self.ser_checkin).days) + 1 - # FIXME: Finalize method! - - @api.multi - def button_confirm(self): - ''' - @param self: object pointer - ''' - self.ensure_one() - self.service_line_id.button_confirm() - - @api.multi - def button_done(self): - ''' - @param self: object pointer - ''' - self.ensure_one() - self.service_line_id.button_done() - - @api.one - def copy_data(self, default=None): - ''' - @param self: object pointer - @param default: dict of default values to be set - ''' - sale_line_obj = self.env['sale.order.line'].browse(self.service_line_id.id) - return sale_line_obj.copy_data(default=default) - - @api.multi - def unlink(self): - for record in self: - record.service_line_id.unlink() - return super(HotelServiceLine, self).unlink() + + diff --git a/hotel/models/hotel_service_type.py b/hotel/models/hotel_service_type.py deleted file mode 100644 index a468d23b9..000000000 --- a/hotel/models/hotel_service_type.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2017 Alexandre Díaz -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields, api, _ - - -class HotelServiceType(models.Model): - _name = "hotel.service.type" - _description = "Service Type" - - name = fields.Char('Service Type', required=True) - # Used for activate records - active = fields.Boolean('Active?', default=True) - - # ser_id = fields.Many2one('product.category', 'category', required=True, - # delegate=True, index=True, ondelete='cascade') - service_ids = fields.One2many('hotel.services', 'service_type_id', - 'Services in this category') - - # @api.multi - # def unlink(self): - # # self.ser_id.unlink() - # return super(HotelServiceType, self).unlink() diff --git a/hotel/models/inherit_product_category.py b/hotel/models/inherit_product_category.py deleted file mode 100644 index b83e75cae..000000000 --- a/hotel/models/inherit_product_category.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api, _ - - -class ProductCategory(models.Model): - _inherit = "product.category" - - # isroomtype = fields.Boolean('Is Room Type') - isamenitytype = fields.Boolean('Is Amenities Type') - isservicetype = fields.Boolean('Is Service Type') diff --git a/hotel/models/inherit_product_product.py b/hotel/models/inherit_product_product.py deleted file mode 100644 index dca420ccb..000000000 --- a/hotel/models/inherit_product_product.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2017 Alexandre Díaz -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api, _ - - -class ProductProduct(models.Model): - _inherit = "product.product" - - is_room_type = fields.Boolean('Is a Room Type', default=False) - # iscategid = fields.Boolean('Is categ id') - # isservice = fields.Boolean('Is Service id') diff --git a/hotel/models/inherit_account_invoice.py b/hotel/models/inherited_account_invoice.py similarity index 74% rename from hotel/models/inherit_account_invoice.py rename to hotel/models/inherited_account_invoice.py index 75e77c2a5..e0e951f07 100644 --- a/hotel/models/inherit_account_invoice.py +++ b/hotel/models/inherited_account_invoice.py @@ -1,10 +1,8 @@ # Copyright 2017 Alexandre Díaz # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -import logging -from openerp import models, fields, api, _ -from openerp.exceptions import UserError, ValidationError -_logger = logging.getLogger(__name__) +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError class AccountInvoice(models.Model): @@ -12,12 +10,11 @@ class AccountInvoice(models.Model): @api.model def create(self, vals): - cr, uid, context = self.env.args - context = dict(context) - if context.get('invoice_origin', False): - vals.update({'origin': context['invoice_origin']}) + if self.env.context.get('invoice_origin', False): + vals.update({'origin': self.env.context.get['invoice_origin']}) return super(AccountInvoice, self).create(vals) + """WIP""" @api.multi def action_folio_payments(self): self.ensure_one() @@ -70,16 +67,3 @@ class AccountInvoice(models.Model): raise ValidationError(vat_error) return super(AccountInvoice, self).action_invoice_open() - # ~ @api.multi - # ~ def confirm_paid(self): - # ~ ''' - # ~ This method change pos orders states to done when folio invoice - # ~ is in done. - # ~ ---------------------------------------------------------- - # ~ @param self: object pointer - # ~ ''' - # ~ pos_order_obj = self.env['pos.order'] - # ~ res = super(AccountInvoice, self).confirm_paid() - # ~ pos_odr_rec = pos_order_obj.search([('invoice_id', 'in', self._ids)]) - # ~ pos_odr_rec and pos_odr_rec.write({'state': 'done'}) - # ~ return res diff --git a/hotel/models/inherit_account_payment.py b/hotel/models/inherited_account_payment.py similarity index 93% rename from hotel/models/inherit_account_payment.py rename to hotel/models/inherited_account_payment.py index 9ac50cb80..bf3b2ee01 100644 --- a/hotel/models/inherit_account_payment.py +++ b/hotel/models/inherited_account_payment.py @@ -1,10 +1,7 @@ # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging -from openerp.exceptions import except_orm -from openerp import models, fields, api, _ -_logger = logging.getLogger(__name__) - +from odoo.exceptions import except_orm +from odoo import models, fields, api, _ class AccountPayment(models.Model): _inherit = 'account.payment' @@ -15,6 +12,7 @@ class AccountPayment(models.Model): string="Total amount in folio", ) + """WIP""" @api.multi def return_payment_folio(self): journal = self.journal_id @@ -78,7 +76,7 @@ class AccountPayment(models.Model): return if not any(fol): return - elif len(fol) > 1: + if len(fol) > 1: raise except_orm(_('Warning'), _('This pay is related with \ more than one Reservation.')) else: diff --git a/hotel/models/inherited_mail_compose_message.py b/hotel/models/inherited_mail_compose_message.py index f2d51b6e1..3fd0ac22b 100644 --- a/hotel/models/inherited_mail_compose_message.py +++ b/hotel/models/inherited_mail_compose_message.py @@ -15,13 +15,7 @@ class MailComposeMessage(models.TransientModel): self._context['default_res_id'] ]) if folio: - cmds = [] - for lid in folio.room_lines.ids: - cmds.append(( - 1, - lid, - {'to_send': False} - )) - if cmds: + cmds = [(1, lid, {'to_send': False}) for lid in folio.room_lines.ids] + if any(cmds): folio.room_lines = cmds return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit) diff --git a/hotel/models/inherit_payment_return.py b/hotel/models/inherited_payment_return.py similarity index 100% rename from hotel/models/inherit_payment_return.py rename to hotel/models/inherited_payment_return.py diff --git a/hotel/models/inherit_product_pricelist.py b/hotel/models/inherited_product_pricelist.py similarity index 74% rename from hotel/models/inherit_product_pricelist.py rename to hotel/models/inherited_product_pricelist.py index 9e9d47bef..4df33a799 100644 --- a/hotel/models/inherit_product_pricelist.py +++ b/hotel/models/inherited_product_pricelist.py @@ -1,23 +1,24 @@ # Copyright 2017 Alexandre Díaz # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, api - +from odoo import models, fields, api class ProductPricelist(models.Model): _inherit = 'product.pricelist' + is_staff = fields.Boolean('Is Staff') + @api.multi @api.depends('name') def name_get(self): pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') + 'res.config.settings', 'default_pricelist_id') if pricelist_id: pricelist_id = int(pricelist_id) org_names = super(ProductPricelist, self).name_get() names = [] for name in org_names: if name[0] == pricelist_id: - names.append((name[0], '%s (Parity)' % name[1])) + names.append((name[0], '%s (Default)' % name[1])) else: names.append((name[0], name[1])) return names diff --git a/hotel/models/inherited_product_template.py b/hotel/models/inherited_product_template.py new file mode 100644 index 000000000..2ae139ff0 --- /dev/null +++ b/hotel/models/inherited_product_template.py @@ -0,0 +1,12 @@ +# Copyright 2017 Alexandre Díaz +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from openerp import models, fields + +class ProductTemplate(models.Model): + _inherit = "product.template" + + is_hotel_service = fields.Boolean('Is a Hotel Service', default=False) + per_day = fields.Boolean('Unit increment per day') + per_person = fields.Boolean('Unit increment per person') + daily_limit = fields.Integer('Daily limit') diff --git a/hotel/models/inherit_res_company.py b/hotel/models/inherited_res_company.py similarity index 94% rename from hotel/models/inherit_res_company.py rename to hotel/models/inherited_res_company.py index 815baeea1..43393f253 100644 --- a/hotel/models/inherit_res_company.py +++ b/hotel/models/inherited_res_company.py @@ -1,7 +1,7 @@ # Copyright 2017 Alexandre Díaz # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api, _ +from odoo import models, fields class ResCompany(models.Model): diff --git a/hotel/models/inherit_res_partner.py b/hotel/models/inherited_res_partner.py similarity index 81% rename from hotel/models/inherit_res_partner.py rename to hotel/models/inherited_res_partner.py index 4760027e7..043f5a55a 100644 --- a/hotel/models/inherit_res_partner.py +++ b/hotel/models/inherited_res_partner.py @@ -1,8 +1,7 @@ # Copyright 2017 Alexandre Díaz # Copyright 2017 Dario Lodeiros # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api, _ - +from openerp import models, fields class ResPartner(models.Model): _inherit = 'res.partner' @@ -21,6 +20,5 @@ class ResPartner(models.Model): ('partner_id.id', '=', record.id) ]) - reservations_count = fields.Integer('Reservations', - compute='_compute_reservations_count') + reservations_count = fields.Integer('Reservations', compute='_compute_reservations_count') folios_count = fields.Integer('Folios', compute='_compute_folios_count') diff --git a/hotel/models/res_config.py b/hotel/models/res_config.py index 99e722491..c2541f639 100644 --- a/hotel/models/res_config.py +++ b/hotel/models/res_config.py @@ -19,9 +19,9 @@ def _tz_get(self): class HotelConfiguration(models.TransientModel): _inherit = 'res.config.settings' - parity_pricelist_id = fields.Many2one('product.pricelist', + default_pricelist_id = fields.Many2one('product.pricelist', 'Product Pricelist') - parity_restrictions_id = fields.Many2one('hotel.room.type.restriction', + default_restriction_id = fields.Many2one('hotel.room.type.restriction', 'Restrictions') default_arrival_hour = fields.Char('Default Arrival Hour (GMT)', help="HH:mm Format", default="14:00") @@ -39,11 +39,11 @@ class HotelConfiguration(models.TransientModel): super(HotelConfiguration, self).set_values() self.env['ir.default'].sudo().set( - 'res.config.settings', 'parity_pricelist_id', - self.parity_pricelist_id.id) + 'res.config.settings', 'default_pricelist_id', + self.default_pricelist_id.id) self.env['ir.default'].sudo().set( - 'res.config.settings', 'parity_restrictions_id', - self.parity_restrictions_id.id) + 'res.config.settings', 'default_restriction_id', + self.default_restriction_id.id) self.env['ir.default'].sudo().set( 'res.config.settings', 'tz_hotel', self.tz_hotel) self.env['ir.default'].sudo().set( @@ -58,10 +58,10 @@ class HotelConfiguration(models.TransientModel): res = super(HotelConfiguration, self).get_values() # ONLY FOR v11. DO NOT FORWARD-PORT - parity_pricelist_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_pricelist_id') - parity_restrictions_id = self.env['ir.default'].sudo().get( - 'res.config.settings', 'parity_restrictions_id') + default_pricelist_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_pricelist_id') + default_restriction_id = self.env['ir.default'].sudo().get( + 'res.config.settings', 'default_restriction_id') tz_hotel = self.env['ir.default'].sudo().get( 'res.config.settings', 'tz_hotel') default_arrival_hour = self.env['ir.default'].sudo().get( @@ -69,8 +69,8 @@ class HotelConfiguration(models.TransientModel): default_departure_hour = self.env['ir.default'].sudo().get( 'res.config.settings', 'default_departure_hour') res.update( - parity_pricelist_id=parity_pricelist_id, - parity_restrictions_id=parity_restrictions_id, + default_pricelist_id=default_pricelist_id, + default_restriction_id=default_restriction_id, tz_hotel=tz_hotel, default_arrival_hour=default_arrival_hour, default_departure_hour=default_departure_hour, diff --git a/hotel/report/__init__.py b/hotel/report/__init__.py deleted file mode 100644 index a89dbe55e..000000000 --- a/hotel/report/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Alexandre Díaz -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from . import hotel_report diff --git a/hotel/report/hotel_report.py b/hotel/report/hotel_report.py deleted file mode 100644 index ae6ffe019..000000000 --- a/hotel/report/hotel_report.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Alexandre Díaz -# Copyright 2017 Dario Lodeiros -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import time -from openerp import models - -# Old SXW engine was removed already in v11. You should update your code with -# current engine tools. -# class FolioReport(): -# def __init__(self, cr, uid, name, context): -# super(FolioReport, self).__init__(cr, uid, name, context) -# self.localcontext.update({'time': time, -# 'get_data': self.get_data, -# 'get_Total': self.getTotal, -# 'get_total': self.gettotal, -# }) -# self.temp = 0.0 -# -# def get_data(self, date_start, date_end): -# folio_obj = self.pool.get('hotel.folio') -# tids = folio_obj.search(self.cr, self.uid, -# [('checkin_date', '>=', date_start), -# ('checkout_date', '<=', date_end)]) -# res = folio_obj.browse(self.cr, self.uid, tids) -# return res -# -# def gettotal(self, total): -# self.temp = self.temp + float(total) -# return total -# -# def getTotal(self): -# return self.temp -# -# -# class ReportLunchorder(models.AbstractModel): -# _name = 'report.hotel.report_hotel_folio' -# _inherit = 'report.report_xlsx.abstract' -# _template = 'hotel.report_hotel_folio' -# _wrapped_report_class = FolioReport diff --git a/hotel/report/hotel_report.xml b/hotel/report/hotel_report.xml deleted file mode 100644 index f6e3916f7..000000000 --- a/hotel/report/hotel_report.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - diff --git a/hotel/report/report_parte_viajero.xml b/hotel/report/report_parte_viajero.xml deleted file mode 100644 index 13758ad5f..000000000 --- a/hotel/report/report_parte_viajero.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - qweb-pdf - 1 - 1 - 201 - - - diff --git a/hotel/security/.~lock.ir.model.access.csv# b/hotel/security/.~lock.ir.model.access.csv# deleted file mode 100644 index 26689e352..000000000 --- a/hotel/security/.~lock.ir.model.access.csv# +++ /dev/null @@ -1 +0,0 @@ -,slimbook,slimbook-PRO,26.07.2018 11:51,file:///home/slimbook/.config/libreoffice/4; \ No newline at end of file diff --git a/hotel/security/ir.model.access.csv b/hotel/security/ir.model.access.csv index fad9d9dee..73c9ce80a 100644 --- a/hotel/security/ir.model.access.csv +++ b/hotel/security/ir.model.access.csv @@ -14,8 +14,8 @@ access_hotel_folio_line,hotel_folio.line.user,model_hotel_reservation,hotel.grou access_hotel_folio_line_call,hotel_folio.line.call,model_hotel_reservation,hotel.group_hotel_call,1,1,1,1 access_hotel_invoice_call,account.invoice.call,account.model_account_invoice,hotel.group_hotel_call,1,1,1,1 access_hotel_invoice_user,account.invoice.user,account.model_account_invoice,hotel.group_hotel_user,1,1,1,1 -access_hotel_model_cardex_call,hotel.currency_exchange.call,hotel.model_cardex,hotel.group_hotel_call,1,1,1,1 -access_hotel_model_cardex_user,hotel.currency_exchange.user,hotel.model_cardex,hotel.group_hotel_user,1,1,1,1 +access_hotel_model_checkin_partner_call,hotel.currency_exchange.call,hotel.model_checkin_partner,hotel.group_hotel_call,1,1,1,1 +access_hotel_model_checkin_partner_user,hotel.currency_exchange.user,hotel.model_checkin_partner,hotel.group_hotel_user,1,1,1,1 access_hotel_order_call,hotel.order.call,sale.model_sale_order,hotel.group_hotel_call,1,1,1,1 access_hotel_order_line_call,hotel.order.line.call,sale.model_sale_order_line,hotel.group_hotel_call,1,1,1,1 access_hotel_order_line_user,hotel.order.line.user,sale.model_sale_order_line,hotel.group_hotel_user,1,1,1,1 diff --git a/hotel/static/description/bed.png b/hotel/static/description/bed.png deleted file mode 100644 index a1f2e0d48..000000000 Binary files a/hotel/static/description/bed.png and /dev/null differ diff --git a/hotel/static/description/book.png b/hotel/static/description/book.png deleted file mode 100644 index 985d40bca..000000000 Binary files a/hotel/static/description/book.png and /dev/null differ diff --git a/hotel/static/description/booking.png b/hotel/static/description/booking.png deleted file mode 100644 index bea6c674c..000000000 Binary files a/hotel/static/description/booking.png and /dev/null differ diff --git a/hotel/static/description/car.png b/hotel/static/description/car.png deleted file mode 100644 index 6c4a1454a..000000000 Binary files a/hotel/static/description/car.png and /dev/null differ diff --git a/hotel/static/description/checkin.png b/hotel/static/description/checkin.png deleted file mode 100644 index 3cc72c398..000000000 Binary files a/hotel/static/description/checkin.png and /dev/null differ diff --git a/hotel/static/description/currency.png b/hotel/static/description/currency.png deleted file mode 100644 index b91654c28..000000000 Binary files a/hotel/static/description/currency.png and /dev/null differ diff --git a/hotel/static/description/fast-food-icons.png b/hotel/static/description/fast-food-icons.png deleted file mode 100644 index e7e148596..000000000 Binary files a/hotel/static/description/fast-food-icons.png and /dev/null differ diff --git a/hotel/static/description/gym.png b/hotel/static/description/gym.png deleted file mode 100644 index a038cd5bf..000000000 Binary files a/hotel/static/description/gym.png and /dev/null differ diff --git a/hotel/static/description/head.png b/hotel/static/description/head.png deleted file mode 100644 index 64aa015bf..000000000 Binary files a/hotel/static/description/head.png and /dev/null differ diff --git a/hotel/static/description/hotel.png b/hotel/static/description/hotel.png deleted file mode 100644 index a31dae49e..000000000 Binary files a/hotel/static/description/hotel.png and /dev/null differ diff --git a/hotel/static/description/hotel1.png b/hotel/static/description/hotel1.png deleted file mode 100644 index e00355335..000000000 Binary files a/hotel/static/description/hotel1.png and /dev/null differ diff --git a/hotel/static/description/hotel2.png b/hotel/static/description/hotel2.png deleted file mode 100644 index 5b43befcc..000000000 Binary files a/hotel/static/description/hotel2.png and /dev/null differ diff --git a/hotel/static/description/icon-book.png b/hotel/static/description/icon-book.png deleted file mode 100644 index 22d8cc291..000000000 Binary files a/hotel/static/description/icon-book.png and /dev/null differ diff --git a/hotel/static/description/inc1.png b/hotel/static/description/inc1.png deleted file mode 100644 index 1104390f1..000000000 Binary files a/hotel/static/description/inc1.png and /dev/null differ diff --git a/hotel/static/description/inc2.png b/hotel/static/description/inc2.png deleted file mode 100644 index 4ee8fa639..000000000 Binary files a/hotel/static/description/inc2.png and /dev/null differ diff --git a/hotel/static/description/inc3.png b/hotel/static/description/inc3.png deleted file mode 100644 index 688e469ba..000000000 Binary files a/hotel/static/description/inc3.png and /dev/null differ diff --git a/hotel/static/description/inc4.png b/hotel/static/description/inc4.png deleted file mode 100644 index 2eb5dc82f..000000000 Binary files a/hotel/static/description/inc4.png and /dev/null differ diff --git a/hotel/static/description/inc5.png b/hotel/static/description/inc5.png deleted file mode 100644 index bb91959e6..000000000 Binary files a/hotel/static/description/inc5.png and /dev/null differ diff --git a/hotel/static/description/inc6.png b/hotel/static/description/inc6.png deleted file mode 100644 index 88b07252e..000000000 Binary files a/hotel/static/description/inc6.png and /dev/null differ diff --git a/hotel/static/description/inc7.png b/hotel/static/description/inc7.png deleted file mode 100644 index 340188a31..000000000 Binary files a/hotel/static/description/inc7.png and /dev/null differ diff --git a/hotel/static/description/inc8.png b/hotel/static/description/inc8.png deleted file mode 100644 index d38788552..000000000 Binary files a/hotel/static/description/inc8.png and /dev/null differ diff --git a/hotel/static/description/inc9.png b/hotel/static/description/inc9.png deleted file mode 100644 index 2c788af93..000000000 Binary files a/hotel/static/description/inc9.png and /dev/null differ diff --git a/hotel/static/description/index.html b/hotel/static/description/index.html deleted file mode 100644 index 8a850002e..000000000 --- a/hotel/static/description/index.html +++ /dev/null @@ -1,56 +0,0 @@ -
-
-
-

HOTEL MANAGEMENT SYSTEM

-
-
-
-
-
-
-

HOTEL BOOKING

-

Book your room.

- - - - - -
-
-

ALL INCLUSIVE

-

Facilities provided

- - - - - -
-
-

AMENITIES

-

Extra class hotel service

- - - - -
-
-

RESTURANTS

-

Bon Appetite !

- - - -
-
-

Currency Exchange

-

Exchange currency on the go

- - -
-
-

REPORTS

-

Manage and Analyze

- - -
-
-
diff --git a/hotel/static/description/key.png b/hotel/static/description/key.png deleted file mode 100644 index b954b8c4d..000000000 Binary files a/hotel/static/description/key.png and /dev/null differ diff --git a/hotel/static/description/menu.png b/hotel/static/description/menu.png deleted file mode 100644 index 0049bb373..000000000 Binary files a/hotel/static/description/menu.png and /dev/null differ diff --git a/hotel/static/description/menu_waitor.png b/hotel/static/description/menu_waitor.png deleted file mode 100644 index 4e53dc77a..000000000 Binary files a/hotel/static/description/menu_waitor.png and /dev/null differ diff --git a/hotel/static/description/money.png b/hotel/static/description/money.png deleted file mode 100644 index f763665a4..000000000 Binary files a/hotel/static/description/money.png and /dev/null differ diff --git a/hotel/static/description/opt.jpg b/hotel/static/description/opt.jpg deleted file mode 100644 index cc596767d..000000000 Binary files a/hotel/static/description/opt.jpg and /dev/null differ diff --git a/hotel/static/description/plate.png b/hotel/static/description/plate.png deleted file mode 100644 index 9460ac611..000000000 Binary files a/hotel/static/description/plate.png and /dev/null differ diff --git a/hotel/static/description/pool_icon.png b/hotel/static/description/pool_icon.png deleted file mode 100644 index aa3bf92c0..000000000 Binary files a/hotel/static/description/pool_icon.png and /dev/null differ diff --git a/hotel/static/description/rent.jpg b/hotel/static/description/rent.jpg deleted file mode 100644 index a2ef21570..000000000 Binary files a/hotel/static/description/rent.jpg and /dev/null differ diff --git a/hotel/static/description/report.png b/hotel/static/description/report.png deleted file mode 100644 index 622ff848d..000000000 Binary files a/hotel/static/description/report.png and /dev/null differ diff --git a/hotel/static/description/report1.png b/hotel/static/description/report1.png deleted file mode 100644 index 16752416f..000000000 Binary files a/hotel/static/description/report1.png and /dev/null differ diff --git a/hotel/static/description/revenue.png b/hotel/static/description/revenue.png deleted file mode 100644 index bcd9b36dc..000000000 Binary files a/hotel/static/description/revenue.png and /dev/null differ diff --git a/hotel/static/description/room.png b/hotel/static/description/room.png deleted file mode 100644 index af9395687..000000000 Binary files a/hotel/static/description/room.png and /dev/null differ diff --git a/hotel/static/description/star_icon.png b/hotel/static/description/star_icon.png deleted file mode 100644 index 1ebe93ec9..000000000 Binary files a/hotel/static/description/star_icon.png and /dev/null differ diff --git a/hotel/static/description/swim.png b/hotel/static/description/swim.png deleted file mode 100644 index b00d78b01..000000000 Binary files a/hotel/static/description/swim.png and /dev/null differ diff --git a/hotel/static/description/travel.png b/hotel/static/description/travel.png deleted file mode 100644 index bd1f6ad43..000000000 Binary files a/hotel/static/description/travel.png and /dev/null differ diff --git a/hotel/static/description/vodna.png b/hotel/static/description/vodna.png deleted file mode 100644 index ca556aaf2..000000000 Binary files a/hotel/static/description/vodna.png and /dev/null differ diff --git a/hotel/static/description/waiter.png b/hotel/static/description/waiter.png deleted file mode 100644 index 86940b889..000000000 Binary files a/hotel/static/description/waiter.png and /dev/null differ diff --git a/hotel/static/src/js/views/list/list_controller.js b/hotel/static/src/js/views/list/list_controller.js new file mode 100644 index 000000000..e45f554cd --- /dev/null +++ b/hotel/static/src/js/views/list/list_controller.js @@ -0,0 +1,28 @@ +odoo.define('hotel.ListController', function(require) { +'use strict'; +/* + * Hotel + * GNU Public License + * Alexandre Díaz + */ + +var ListController = require('web.ListController'); +var Core = require('web.core'); + +var _t = Core._t; + +ListController.include({ + + renderButtons: function () { + this._super.apply(this, arguments); // Sets this.$buttons + var self = this; + if (this.modelName === 'hotel.reservation') { + this.$buttons.append(""); + this.$buttons.find('.oe_open_reservation_wizard').on('click', function(){ + self.do_action('hotel.open_wizard_reservations'); + }); + } + } +}); + +}); diff --git a/hotel/tests/common.py b/hotel/tests/common.py index 85427ec90..99ba08061 100644 --- a/hotel/tests/common.py +++ b/hotel/tests/common.py @@ -96,16 +96,16 @@ class TestHotel(TestMail): # Minimal Hotel Configuration cls.tz_hotel = 'Europe/Madrid' - cls.parity_pricelist_id = cls.pricelist_1.id - cls.parity_restrictions_id = cls.restriction_1.id + cls.default_pricelist_id = cls.pricelist_1.id + cls.default_restriction_id = cls.restriction_1.id cls.env['ir.values'].sudo().set_default('res.config.settings', 'tz_hotel', cls.tz_hotel) cls.env['ir.values'].sudo().set_default('res.config.settings', - 'parity_pricelist_id', - cls.parity_pricelist_id) + 'default_pricelist_id', + cls.default_pricelist_id) cls.env['ir.values'].sudo().set_default('res.config.settings', - 'parity_restrictions_id', - cls.parity_restrictions_id) + 'default_restriction_id', + cls.default_restriction_id) # User Groups user_group_hotel_manager = cls.env.ref('hotel.group_hotel_manager') @@ -234,14 +234,14 @@ class TestHotel(TestMail): }) room_type_rest_item_obj.create({ 'room_type_id': k_vr, - 'restriction_id': cls.parity_restrictions_id, + 'restriction_id': cls.default_restriction_id, 'date_start': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'applied_on': '0_room_type', 'min_stay': cls.restrictions_min_stay_tmp[k_vr][i], }) pricelist_item_obj.create({ - 'pricelist_id': cls.parity_pricelist_id, + 'pricelist_id': cls.default_pricelist_id, 'date_start': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT), 'compute_price': 'fixed', diff --git a/hotel/views/currency_exchange.xml b/hotel/views/currency_exchange.xml deleted file mode 100644 index 1efd9fba3..000000000 --- a/hotel/views/currency_exchange.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - currency.exchange.form - currency.exchange - -
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -

- -
-
-
-
- - - - currency.exchange.tree - currency.exchange - - - - - - - - - - - - - Currency Exchange - currency.exchange - form - tree,form - - -
diff --git a/hotel/views/general.xml b/hotel/views/general.xml new file mode 100644 index 000000000..8431bcca3 --- /dev/null +++ b/hotel/views/general.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/hotel/views/hotel_board_service_views.xml b/hotel/views/hotel_board_service_views.xml new file mode 100644 index 000000000..0dbc15fba --- /dev/null +++ b/hotel/views/hotel_board_service_views.xml @@ -0,0 +1,48 @@ + + + + + + + hotel.board.service.form + hotel.board.service + +
+ + + + + + + + + +
+
+
+ + + + hotel.board.service.tree + hotel.board.service + + + + + + + + + + + Board Services + hotel.board.service + form + tree,form + + + + +
diff --git a/hotel/views/cardex.xml b/hotel/views/hotel_checkin_partner_views.xml similarity index 63% rename from hotel/views/cardex.xml rename to hotel/views/hotel_checkin_partner_views.xml index e5b7dfa4f..91ce85e65 100644 --- a/hotel/views/cardex.xml +++ b/hotel/views/hotel_checkin_partner_views.xml @@ -1,57 +1,57 @@ - - - - - - - - - - Cardex Form - cardex - -
- - - - - - - - - - - - -
-
-
- - - Cardex Tree - cardex - - - - - - - - - - - -
+ + + + + + + + + + Checkin Form + hotel.checkin.partner + +
+ + + + + + + + + + + + +
+
+
+ + + Checkin Tree + hotel.checkin.partner + + + + + + + + + + + +
diff --git a/hotel/views/hotel_dashboard.xml b/hotel/views/hotel_dashboard.xml deleted file mode 100644 index f214e9310..000000000 --- a/hotel/views/hotel_dashboard.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - - - Folios - hotel.dashboard - - - - Folios - hotel.dashboard - - - - Folios - hotel.dashboard - - - - Folios - hotel.dashboard - - - - hotel.dashboard.view - hotel.dashboard - - - - - - - Hotel Dashboard - hotel.dashboard - ir.actions.act_window - form - {} - kanban - - - - - - - - - Chekins Dashboard - sales - bar - 1 - - - On Board - sales - line - 1 - - - - diff --git a/hotel/views/hotel_floor.xml b/hotel/views/hotel_floor_views.xml similarity index 92% rename from hotel/views/hotel_floor.xml rename to hotel/views/hotel_floor_views.xml index 39012071a..871ff17ae 100644 --- a/hotel/views/hotel_floor.xml +++ b/hotel/views/hotel_floor_views.xml @@ -3,7 +3,7 @@ - + hotel.floor.form hotel.floor @@ -19,7 +19,7 @@ - + hotel.floor.tree hotel.floor diff --git a/hotel/views/hotel_folio.xml b/hotel/views/hotel_folio_views.xml similarity index 94% rename from hotel/views/hotel_folio.xml rename to hotel/views/hotel_folio_views.xml index a3a3c73a7..5f33d8a2e 100644 --- a/hotel/views/hotel_folio.xml +++ b/hotel/views/hotel_folio_views.xml @@ -3,7 +3,7 @@ - + hotel.folio.form hotel.folio @@ -40,26 +40,26 @@
-
- - - - - - - - - - - - - - - -
- -
-
- - - - hotel.room_type.tree - hotel.room.type - - - - - - - - - - - - - - - Room Type - hotel.room.type - form - tree,form - - - - - diff --git a/hotel/views/hotel_room_type_availability.xml b/hotel/views/hotel_room_type_availability_views.xml similarity index 100% rename from hotel/views/hotel_room_type_availability.xml rename to hotel/views/hotel_room_type_availability_views.xml diff --git a/hotel/views/hotel_room_type_class_views.xml b/hotel/views/hotel_room_type_class_views.xml new file mode 100644 index 000000000..75b3c34e0 --- /dev/null +++ b/hotel/views/hotel_room_type_class_views.xml @@ -0,0 +1,59 @@ + + + + + + hotel.room.type.class.form + hotel.room.type.class + +
+ +
+ +
+ + + + + + + + + + + +
+
+
+
+ + + + hotel.room.type.class.tree + hotel.room.type.class + + + + + + + + + + + + + Room Type Class + hotel.room.type.class + form + tree,form + + + +
diff --git a/hotel/views/hotel_room_type_restriction_item_views.xml b/hotel/views/hotel_room_type_restriction_item_views.xml index 64c4dbde4..f36bd7ac2 100644 --- a/hotel/views/hotel_room_type_restriction_item_views.xml +++ b/hotel/views/hotel_room_type_restriction_item_views.xml @@ -8,9 +8,7 @@
- - - + @@ -37,9 +35,7 @@ hotel.room.type.restriction.item - - - + diff --git a/hotel/views/hotel_room_type_restriction_views.xml b/hotel/views/hotel_room_type_restriction_views.xml index 7ae67cd12..cf8c6f906 100644 --- a/hotel/views/hotel_room_type_restriction_views.xml +++ b/hotel/views/hotel_room_type_restriction_views.xml @@ -18,9 +18,7 @@ - - - + diff --git a/hotel/views/hotel_room_type_views.xml b/hotel/views/hotel_room_type_views.xml index 7177a4f6e..b31b0be9d 100644 --- a/hotel/views/hotel_room_type_views.xml +++ b/hotel/views/hotel_room_type_views.xml @@ -1,72 +1,74 @@ - + - - - room.type.view.form + + + hotel.room_type.form hotel.room.type - + -
- -
+
+ +
- - - - - - + + + + + + + - - + - - + - - - - + + + + + + +
- - - room.type.view.tree + + + hotel.room_type.tree hotel.room.type - - - + + + + + - - - - - Virtual Rooms + + + Room Type hotel.room.type form tree,form - + + + - - - -
+ diff --git a/hotel/views/hotel_room.xml b/hotel/views/hotel_room_views.xml similarity index 95% rename from hotel/views/hotel_room.xml rename to hotel/views/hotel_room_views.xml index 2fdbc6360..137ca6579 100644 --- a/hotel/views/hotel_room.xml +++ b/hotel/views/hotel_room_views.xml @@ -3,7 +3,7 @@ - + hotel.room.form hotel.room @@ -47,10 +47,6 @@ - - - - @@ -67,7 +63,7 @@ - + hotel.room.search hotel.room @@ -85,7 +81,7 @@ - + hotel.room.tree hotel.room @@ -173,7 +169,7 @@ form - + kanban,tree,form diff --git a/hotel/views/hotel_service_line.xml b/hotel/views/hotel_service_line_views.xml similarity index 95% rename from hotel/views/hotel_service_line.xml rename to hotel/views/hotel_service_line_views.xml index f10d988de..6f77df65c 100644 --- a/hotel/views/hotel_service_line.xml +++ b/hotel/views/hotel_service_line_views.xml @@ -3,7 +3,7 @@ - + hotel.service.line.form hotel.service.line @@ -35,7 +35,7 @@ - + hotel.service.line.tree hotel.service.line diff --git a/hotel/views/hotel_service_type.xml b/hotel/views/hotel_service_type_views.xml similarity index 93% rename from hotel/views/hotel_service_type.xml rename to hotel/views/hotel_service_type_views.xml index c657d358b..5b2ba1823 100644 --- a/hotel/views/hotel_service_type.xml +++ b/hotel/views/hotel_service_type_views.xml @@ -3,7 +3,7 @@ - + hotel.service_type.form hotel.service.type @@ -21,7 +21,7 @@ - + hotel.service_type.tree hotel.service.type diff --git a/hotel/views/hotel_service.xml b/hotel/views/hotel_service_views.xml similarity index 97% rename from hotel/views/hotel_service.xml rename to hotel/views/hotel_service_views.xml index c6c65a540..e3741c27b 100644 --- a/hotel/views/hotel_service.xml +++ b/hotel/views/hotel_service_views.xml @@ -2,7 +2,7 @@ - + .hotel.service.form hotel.service @@ -64,7 +64,7 @@ - + hotel.service.search hotel.service @@ -83,7 +83,7 @@ - + hotel.service.tree hotel.service diff --git a/hotel/views/inherit_product_product.xml b/hotel/views/inherit_product_product.xml deleted file mode 100644 index 26a650cf4..000000000 --- a/hotel/views/inherit_product_product.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - view.product.product.form.inherited - product.product - - - - - - - - - diff --git a/hotel/views/inherit_reservation_workflow.xml b/hotel/views/inherit_reservation_workflow.xml deleted file mode 100755 index a00e64a73..000000000 --- a/hotel/views/inherit_reservation_workflow.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - checkin - function - action_reservation_checkin() - - - - - - done - - - - - %(launch_checkin_wizard)d - - - diff --git a/hotel/views/inherit_account_invoice_views.xml b/hotel/views/inherited_account_invoice_views.xml similarity index 100% rename from hotel/views/inherit_account_invoice_views.xml rename to hotel/views/inherited_account_invoice_views.xml diff --git a/hotel/views/inherit_account_payment_views.xml b/hotel/views/inherited_account_payment_views.xml similarity index 96% rename from hotel/views/inherit_account_payment_views.xml rename to hotel/views/inherited_account_payment_views.xml index c29f85854..25fbfb56a 100644 --- a/hotel/views/inherit_account_payment_views.xml +++ b/hotel/views/inherited_account_payment_views.xml @@ -1,7 +1,7 @@ - + account.payment @@ -11,7 +11,7 @@ - + account.payment.folio.form account.payment diff --git a/hotel/views/inherited_product_template_views.xml b/hotel/views/inherited_product_template_views.xml new file mode 100644 index 000000000..ba3dd61e3 --- /dev/null +++ b/hotel/views/inherited_product_template_views.xml @@ -0,0 +1,26 @@ + + + + + view.product.template.form.inherited + product.template + + + + + + + + + + + + + + + + + + + + diff --git a/hotel/views/inherit_res_partner.xml b/hotel/views/inherited_res_partner_views.xml similarity index 92% rename from hotel/views/inherit_res_partner.xml rename to hotel/views/inherited_res_partner_views.xml index 0101d2e24..c2a68add2 100644 --- a/hotel/views/inherit_res_partner.xml +++ b/hotel/views/inherited_res_partner_views.xml @@ -13,8 +13,8 @@ [('partner_id', '=',active_id)] - - hotel.view.partner.form + + res.partner.view.form res.partner @@ -32,6 +32,7 @@ + diff --git a/hotel/views/report_hotel_management.xml b/hotel/views/report_hotel_management.xml deleted file mode 100644 index 5e24f6971..000000000 --- a/hotel/views/report_hotel_management.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - - diff --git a/hotel/views/res_config.xml b/hotel/views/res_config.xml index 2be495cfa..168b8f790 100644 --- a/hotel/views/res_config.xml +++ b/hotel/views/res_config.xml @@ -10,27 +10,27 @@
-

Hotel Parity

+

Hotel Default

-
-
diff --git a/hotel/wizard/__init__.py b/hotel/wizard/__init__.py index ae08f23cd..9fbcd6f9e 100644 --- a/hotel/wizard/__init__.py +++ b/hotel/wizard/__init__.py @@ -21,10 +21,10 @@ # along with this program. If not, see . # ############################################################################## -from . import hotel_wizard from . import folio_make_invoice_advance from . import checkinwizard from . import massive_changes from . import split_reservation from . import duplicate_reservation from . import massive_price_reservation_days +from . import wizard_reservation diff --git a/hotel/wizard/checkinwizard.py b/hotel/wizard/checkinwizard.py index a9a26528e..2ce8cce0b 100644 --- a/hotel/wizard/checkinwizard.py +++ b/hotel/wizard/checkinwizard.py @@ -34,9 +34,9 @@ class Wizard(models.TransientModel): # return current room line (onlyone in this case) return reservations for res in reservations: - # return the first room line with free space for a cardex + # return the first room line with free space for a checkin # TODO: add 'done' to res.state condition... Maybe too restrictive right now - if res.cardex_count < (res.adults + res.children) and \ + if res.checkin_partner_count < (res.adults + res.children) and \ res.state not in ["cancelled"]: return res elif 'reservation_id' in self.env.context: @@ -50,14 +50,14 @@ class Wizard(models.TransientModel): # no partner by default. User must search and choose one return False - def default_cardex_ids(self): + def default_checkin_partner_ids(self): if ('reservation_ids' and 'folio') in self.env.context: ids = [item[1] for item in self.env.context.get('reservation_ids')] reservations = self.env['hotel.reservation'].browse(ids) for res in reservations: - return res.cardex_ids + return res.checkin_partner_ids - def default_cardex_ids(self): + def default_checkin_partner_ids(self): if ('reservation_ids' and 'folio') in self.env.context: ids = [item[1] for item in self.env.context.get('reservation_ids')] reservations = self.env['hotel.reservation'].browse(ids) @@ -65,38 +65,38 @@ class Wizard(models.TransientModel): return res.segmentation_id ''' TODO: clean-up - def default_count_cardex(self): + def default_count_checkin_partner(self): if 'reservation_ids' and 'folio' in self.env.context: ids = [item[1] for item in self.env.context['reservation_ids']] reservations = self.env['hotel.reservation'].browse(ids) for res in reservations: - return res.cardex_count + return res.checkin_partner_count ''' ''' TODO: clean-up - def default_pending_cardex(self): + def default_pending_checkin_partner(self): if 'reservation_ids' and 'folio' in self.env.context: ids = [item[1] for item in self.env.context['reservation_ids']] reservations = self.env['hotel.reservation'].browse(ids) for res in reservations: - return res.adults + res.children - res.cardex_count + return res.adults + res.children - res.checkin_partner_count ''' ''' TODO: clean-up - list of checkins on smart button clean is not used anymore def comp_checkin_list_visible(self): if 'partner_id' in self.env.context: - self.list_checkin_cardex = False + self.list_checkin_checkin_partner = False return ''' def comp_checkin_edit(self): - if 'edit_cardex' in self.env.context: + if 'edit_checkin_partner' in self.env.context: return True return False - cardex_ids = fields.Many2many('cardex', 'reservation_id', - default=default_cardex_ids) - # count_cardex = fields.Integer('Cardex counter', - # default=default_count_cardex) - # pending_cardex = fields.Integer('Cardex pending', - # default=default_pending_cardex) + checkin_partner_ids = fields.Many2many('hotel.checkin.partner', 'reservation_id', + default=default_checkin_partner_ids) + # count_checkin_partner = fields.Integer('Checkin counter', + # default=default_count_checkin_partner) + # pending_checkin_partner = fields.Integer('Checkin pending', + # default=default_pending_checkin_partner) partner_id = fields.Many2one('res.partner', default=default_partner_id) reservation_id = fields.Many2one('hotel.reservation', @@ -106,24 +106,24 @@ class Wizard(models.TransientModel): exit_date = fields.Date(default=default_exit_date, required=True) - firstname_cardex = fields.Char('Firstname', + firstname_checkin_partner = fields.Char('Firstname', required=True) - lastname_cardex = fields.Char('Lastname', + lastname_checkin_partner = fields.Char('Lastname', required=True) - email_cardex = fields.Char('E-mail') + email_checkin_partner = fields.Char('E-mail') - mobile_cardex = fields.Char('Mobile') + mobile_checkin_partner = fields.Char('Mobile') segmentation_id = fields.Many2many( related='reservation_id.folio_id.segmentation_ids') ''' TODO: clean-up - list of checkins on smart button clean is not used anymore - list_checkin_cardex = fields.Boolean(compute=comp_checkin_list_visible, + list_checkin_checkin_partner = fields.Boolean(compute=comp_checkin_list_visible, default=True, store=True) ''' - # edit_checkin_cardex = fields.Boolean(default=comp_checkin_edit, + # edit_checkin_checkin_partner = fields.Boolean(default=comp_checkin_edit, # store=True) op_select_partner = fields.Selection([ @@ -142,42 +142,39 @@ class Wizard(models.TransientModel): if self.op_select_partner == 'S': partner_vals = { 'id': self.partner_id.id, - 'firstname': self.firstname_cardex, - 'lastname': self.lastname_cardex, - 'email': self.email_cardex, - 'mobile': self.mobile_cardex, + 'firstname': self.firstname_checkin_partner, + 'lastname': self.lastname_checkin_partner, + 'email': self.email_checkin_partner, + 'mobile': self.mobile_checkin_partner, } self.partner_id.sudo().write(partner_vals) elif self.op_select_partner == 'C': partner_vals = { - 'firstname': self.firstname_cardex, - 'lastname': self.lastname_cardex, - 'email': self.email_cardex, - 'mobile': self.mobile_cardex, + 'firstname': self.firstname_checkin_partner, + 'lastname': self.lastname_checkin_partner, + 'email': self.email_checkin_partner, + 'mobile': self.mobile_checkin_partner, } new_partner = self.env['res.partner'].create(partner_vals) self.partner_id = self.env['res.partner'].browse(new_partner.id) # prepare checkin values - cardex_val = { + checkin_partner_val = { 'partner_id': self.partner_id.id, 'enter_date': self.enter_date, 'exit_date': self.exit_date } record_id = self.env['hotel.reservation'].browse( self.reservation_id.id) - # save the cardex for this reservation + # save the checkin for this reservation record_id.write({ - 'cardex_ids': [(0, False, cardex_val)], + 'checkin_partner_ids': [(0, False, checkin_partner_val)], 'segmentation_id': self.segmentation_id, }) # update the state of the current reservation - if record_id.cardex_count > 0: + if record_id.checkin_partner_count > 0: record_id.state = 'booking' - record_id.is_checkin = False - folio = self.env['hotel.folio'].browse(self.reservation_id.folio_id.id) - folio.checkins_reservations -= 1 @api.onchange('reservation_id') def change_enter_exit_date(self): @@ -192,11 +189,11 @@ class Wizard(models.TransientModel): ids = [item[1] for item in self.env.context['reservation_ids']] reservations = self.env['hotel.reservation'].browse(ids) for res in reservations: - _logger.info('reservation cardex_count %d', res.cardex_count) + _logger.info('reservation checkin_partner_count %d', res.checkin_partner_count) # return { - # 'domain': {'reservation_id': [('folio_id','=', self.env.context['folio']), 'count_cardex','=','2']}, - # 'warning': {'title': "Warning", 'message': self.env.context['cardex_count']}, + # 'domain': {'reservation_id': [('folio_id','=', self.env.context['folio']), 'count_checkin_partner','=','2']}, + # 'warning': {'title': "Warning", 'message': self.env.context['checkin_partner_count']}, # } ''' @@ -204,10 +201,10 @@ class Wizard(models.TransientModel): def onchange_partner_id(self): # update partner fields write_vals = { - 'firstname_cardex': self.partner_id.firstname, - 'lastname_cardex': self.partner_id.lastname, - 'email_cardex': self.partner_id.email, - 'mobile_cardex': self.partner_id.mobile, + 'firstname_checkin_partner': self.partner_id.firstname, + 'lastname_checkin_partner': self.partner_id.lastname, + 'email_checkin_partner': self.partner_id.email, + 'mobile_checkin_partner': self.partner_id.mobile, } # show the checkin fields if a partner is selected if self.op_select_partner == 'S' and self.partner_id.id != False: diff --git a/hotel/wizard/checkinwizard.xml b/hotel/wizard/checkinwizard.xml index c69e399e8..6b582c9c9 100644 --- a/hotel/wizard/checkinwizard.xml +++ b/hotel/wizard/checkinwizard.xml @@ -10,7 +10,7 @@ @@ -25,13 +25,13 @@ - - + + - - + +
@@ -41,7 +41,7 @@ - +
@@ -66,17 +66,17 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hotel_channel_connector/views/channel_hotel_reservation_views.xml b/hotel_channel_connector/views/channel_hotel_reservation_views.xml index f75d53daa..bf6057427 100644 --- a/hotel_channel_connector/views/channel_hotel_reservation_views.xml +++ b/hotel_channel_connector/views/channel_hotel_reservation_views.xml @@ -7,7 +7,7 @@
- + 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 index d55fa121f..c8e34c01c 100644 --- a/hotel_channel_connector/views/channel_hotel_room_type_availability_views.xml +++ b/hotel_channel_connector/views/channel_hotel_room_type_availability_views.xml @@ -6,6 +6,10 @@ 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 new file mode 100644 index 000000000..da7933657 --- /dev/null +++ b/hotel_channel_connector/views/channel_hotel_room_type_restriction_item_views.xml @@ -0,0 +1,30 @@ + + + + + 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 index 662cc317c..d8956faad 100644 --- a/hotel_channel_connector/views/channel_hotel_room_type_restriction_views.xml +++ b/hotel_channel_connector/views/channel_hotel_room_type_restriction_views.xml @@ -7,8 +7,11 @@
- - + + + + +
diff --git a/hotel_channel_connector/views/channel_hotel_room_type_views.xml b/hotel_channel_connector/views/channel_hotel_room_type_views.xml index 846964b59..5cc063650 100644 --- a/hotel_channel_connector/views/channel_hotel_room_type_views.xml +++ b/hotel_channel_connector/views/channel_hotel_room_type_views.xml @@ -7,10 +7,11 @@
+ - + diff --git a/hotel_channel_connector/views/channel_ota_info_views.xml b/hotel_channel_connector/views/channel_ota_info_views.xml index 8dcc4dff8..d6a152922 100644 --- a/hotel_channel_connector/views/channel_ota_info_views.xml +++ b/hotel_channel_connector/views/channel_ota_info_views.xml @@ -8,6 +8,10 @@ + + + + @@ -30,11 +34,4 @@ - - Hotel Channel Connector OTA's Info - channel.ota.info - form - tree,form - - diff --git a/hotel_channel_connector/views/channel_product_pricelist_item_views.xml b/hotel_channel_connector/views/channel_product_pricelist_item_views.xml new file mode 100644 index 000000000..b8cb4554d --- /dev/null +++ b/hotel_channel_connector/views/channel_product_pricelist_item_views.xml @@ -0,0 +1,27 @@ + + + + + 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 index 1e64681d2..5f23c0c21 100644 --- a/hotel_channel_connector/views/channel_product_pricelist_views.xml +++ b/hotel_channel_connector/views/channel_product_pricelist_views.xml @@ -7,14 +7,18 @@
- + + + + +
- + channel.hotel.product.pricelist.tree channel.product.pricelist diff --git a/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml b/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml index 5732014df..10e854da5 100644 --- a/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml +++ b/hotel_channel_connector/views/hotel_channel_connector_issue_views.xml @@ -18,6 +18,9 @@ class="oe_stat_button" icon="fa-warning" attrs="{'invisible':['|', ['section', '!=', 'reservation'], ['channel_object_id', '=', False]]}"/>
+ + + @@ -42,6 +45,7 @@ tree + @@ -58,6 +62,7 @@ hotel.channel.connector.issue + diff --git a/hotel_channel_connector/views/inherited_hotel_reservation_views.xml b/hotel_channel_connector/views/inherited_hotel_reservation_views.xml index 143f9247c..6b78a11c2 100644 --- a/hotel_channel_connector/views/inherited_hotel_reservation_views.xml +++ b/hotel_channel_connector/views/inherited_hotel_reservation_views.xml @@ -8,7 +8,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_availability_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_availability_views.xml index c93b12a18..d7f17c58e 100644 --- a/hotel_channel_connector/views/inherited_hotel_room_type_availability_views.xml +++ b/hotel_channel_connector/views/inherited_hotel_room_type_availability_views.xml @@ -8,7 +8,7 @@ - + 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 new file mode 100644 index 000000000..f28fe7e7f --- /dev/null +++ b/hotel_channel_connector/views/inherited_hotel_room_type_restriction_item_views.xml @@ -0,0 +1,24 @@ + + + + + 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 index 86ef97d11..d640d760f 100644 --- a/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml +++ b/hotel_channel_connector/views/inherited_hotel_room_type_restriction_views.xml @@ -5,11 +5,19 @@ hotel.room.type.restriction - -
-
-
+ + + + + + + + + + + + +
diff --git a/hotel_channel_connector/views/inherited_hotel_room_type_views.xml b/hotel_channel_connector/views/inherited_hotel_room_type_views.xml index e75a7a7c0..70251b4b6 100644 --- a/hotel_channel_connector/views/inherited_hotel_room_type_views.xml +++ b/hotel_channel_connector/views/inherited_hotel_room_type_views.xml @@ -7,7 +7,7 @@ - + diff --git a/hotel_channel_connector/views/inherited_product_pricelist_item_views.xml b/hotel_channel_connector/views/inherited_product_pricelist_item_views.xml index 696e56773..9f93bdc2b 100644 --- a/hotel_channel_connector/views/inherited_product_pricelist_item_views.xml +++ b/hotel_channel_connector/views/inherited_product_pricelist_item_views.xml @@ -5,12 +5,19 @@ product.pricelist.item - - - - - - {'readonly': [('is_daily_plan', '=', True)]} + + + + + + + + + + + + +
diff --git a/hotel_channel_connector/views/inherited_product_pricelist_views.xml b/hotel_channel_connector/views/inherited_product_pricelist_views.xml index ab4882128..0f1018f0b 100644 --- a/hotel_channel_connector/views/inherited_product_pricelist_views.xml +++ b/hotel_channel_connector/views/inherited_product_pricelist_views.xml @@ -5,14 +5,19 @@ product.pricelist - -
-
-
- - - + + + + + + + + + + + + +
diff --git a/hotel_channel_connector/wizard/wubook_import_plan_prices.py b/hotel_channel_connector/wizard/wubook_import_plan_prices.py index b07c5ec3e..60ee6fb86 100644 --- a/hotel_channel_connector/wizard/wubook_import_plan_prices.py +++ b/hotel_channel_connector/wizard/wubook_import_plan_prices.py @@ -21,7 +21,6 @@ ############################################################################## from openerp.exceptions import ValidationError from openerp import models, fields, api, _ -from odoo.addons.hotel import date_utils from ..components.backend_adapter import DEFAULT_WUBOOK_DATE_FORMAT @@ -37,8 +36,8 @@ class ImportPlanPricesWizard(models.TransientModel): self.env.context.get('active_id')) if pricelist_id: for record in self: - date_start_dt = date_utils.get_datetime(record.date_start) - date_end_dt = date_utils.get_datetime(record.date_end) + date_start_dt = fields.Date.from_string(record.date_start) + date_end_dt = fields.Date.from_string(record.date_end) wres = self.env['wubook'].fetch_plan_prices( pricelist_id.wpid, date_start_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT), diff --git a/hotel_channel_connector/wizard/wubook_import_plan_restrictions.py b/hotel_channel_connector/wizard/wubook_import_plan_restrictions.py index 2bca289ad..6f834bfd9 100644 --- a/hotel_channel_connector/wizard/wubook_import_plan_restrictions.py +++ b/hotel_channel_connector/wizard/wubook_import_plan_restrictions.py @@ -21,7 +21,6 @@ ############################################################################## from openerp.exceptions import ValidationError from openerp import models, fields, api, _ -from odoo.addons.hotel import date_utils from ..components.backend_adapter import DEFAULT_WUBOOK_DATE_FORMAT @@ -37,8 +36,8 @@ class ImportPlanRestrictionsWizard(models.TransientModel): self.env.context.get('active_id')) if restriction_id: for record in self: - date_start_dt = date_utils.get_datetime(record.date_start) - date_end_dt = date_utils.get_datetime(record.date_end) + date_start_dt = fields.Date.from_string(record.date_start) + date_end_dt = fields.Date.from_string(record.date_end) if int(restriction_id.wpid) == 0: wres = self.env['wubook'].fetch_rooms_values( date_start_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),