diff --git a/README.md b/README.md index 558f865366d..370ce1457d6 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ Available addons addon | version | summary --- | --- | --- [multi_pms_properties](multi_pms_properties/) | 14.0.1.0.0 | Multi Properties Manager -[pms](pms/) | 14.0.2.14.0 | A property management system +[pms](pms/) | 14.0.2.15.1 | A property management system [pms_housekeeping](pms_housekeeping/) | 14.0.1.0.1 | Housekeeping -[pms_l10n_es](pms_l10n_es/) | 14.0.2.0.0 | PMS Spanish Adaptation +[pms_l10n_es](pms_l10n_es/) | 14.0.2.0.1 | PMS Spanish Adaptation [pms_rooming_xls](pms_rooming_xls/) | 14.0.1.0.0 | Rooming xlsx Management [//]: # (end addons) diff --git a/oca_dependencies.txt b/oca_dependencies.txt index 1017cfa527d..880f634be15 100644 --- a/oca_dependencies.txt +++ b/oca_dependencies.txt @@ -2,3 +2,4 @@ partner-contact reporting-engine queue connector +community-data-files \ No newline at end of file diff --git a/pms/__manifest__.py b/pms/__manifest__.py index 117f50d37f7..f9403bac028 100644 --- a/pms/__manifest__.py +++ b/pms/__manifest__.py @@ -4,7 +4,7 @@ { "name": "PMS (Property Management System)", "summary": "A property management system", - "version": "14.0.2.14.0", + "version": "14.0.2.15.1", "development_status": "Alpha", "category": "Generic Modules/Property Management System", "website": "https://github.com/OCA/pms", diff --git a/pms/i18n/es.po b/pms/i18n/es.po index 3821e86f5e5..695b0a0dcb2 100644 --- a/pms/i18n/es.po +++ b/pms/i18n/es.po @@ -110,7 +110,7 @@ msgstr "" "'Order - %s' % (object.name)" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid ", at" msgstr "" @@ -282,7 +282,7 @@ msgid "Checkout:" msgstr "Total" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Copy for the host" msgstr "" @@ -1176,7 +1176,7 @@ msgstr "" #: model:ir.model.fields,field_description:pms.field_pms_property__birthdate_date #: model:ir.model.fields,field_description:pms.field_res_partner__birthdate_date #: model:ir.model.fields,field_description:pms.field_res_users__birthdate_date -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Birthdate" msgstr "" @@ -1356,7 +1356,7 @@ msgid "By Week" msgstr "Por Semana" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "CIF:" msgstr "" @@ -2700,12 +2700,12 @@ msgid "Document Type" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Document number" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Document number:" msgstr "" @@ -2873,7 +2873,7 @@ msgid "Enter" msgstr "Entrada" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Entry date" msgstr "" @@ -2898,7 +2898,7 @@ msgid "Exit" msgstr "Salida" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Exit date" msgstr "" @@ -2908,7 +2908,7 @@ msgid "Expedition Date" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Expedition date" msgstr "" @@ -3373,7 +3373,7 @@ msgstr "" #: model:ir.model.fields,field_description:pms.field_pms_checkin_partner__gender #: model:ir.model.fields,field_description:pms.field_pms_property__gender #: model:ir.model.fields,field_description:pms.field_res_partner__gender -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Gender" msgstr "" @@ -4595,7 +4595,7 @@ msgstr "" "crédito no conciliado o si hace click en el botón \"Listo\"." #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Lastnames" msgstr "" @@ -4941,7 +4941,7 @@ msgstr "Mis reservas" #: model_terms:ir.ui.view,arch_db:pms.availability_view_form #: model_terms:ir.ui.view,arch_db:pms.pms_room_view_form #: model_terms:ir.ui.view,arch_db:pms.pms_shared_room_view_form -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Name" msgstr "Nombre" @@ -5501,7 +5501,7 @@ msgid "Overbookings" msgstr "Overbookings" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "PART OF TRAVELERS ENTRY" msgstr "" @@ -7907,7 +7907,7 @@ msgid "System Parameter" msgstr "Parámetro del sistema" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "TRAVELER'S DOCUMENT" msgstr "" @@ -8784,7 +8784,7 @@ msgid "Total amount" msgstr "Cantidad total" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Total amount (Reservation Card):" msgstr "" @@ -8872,7 +8872,7 @@ msgid "Transactions" msgstr "Transacciones" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Traveler's signature" msgstr "" @@ -8900,7 +8900,7 @@ msgstr "Martes" #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_folio__reservation_type -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Type" msgstr "TIpo" diff --git a/pms/i18n/pms.pot b/pms/i18n/pms.pot index c4be405d607..806841a451d 100644 --- a/pms/i18n/pms.pot +++ b/pms/i18n/pms.pot @@ -102,7 +102,7 @@ msgid "" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid ", at" msgstr "" @@ -252,7 +252,7 @@ msgid "Checkout:" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Copy for the host" msgstr "" @@ -1088,7 +1088,7 @@ msgstr "" #: model:ir.model.fields,field_description:pms.field_pms_property__birthdate_date #: model:ir.model.fields,field_description:pms.field_res_partner__birthdate_date #: model:ir.model.fields,field_description:pms.field_res_users__birthdate_date -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Birthdate" msgstr "" @@ -1266,7 +1266,7 @@ msgid "By Week" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "CIF:" msgstr "" @@ -1417,6 +1417,11 @@ msgstr "" msgid "Channels" msgstr "" +#. module: pms +#: model:ir.model.fields,field_description:pms.field_pms_reservation__check_adults +msgid "Check Adults" +msgstr "" + #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_reservation__checkin #: model:ir.model.fields,field_description:pms.field_pms_reservation_split_join_swap_wizard__checkin @@ -1627,6 +1632,7 @@ msgstr "" #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_property__city +#: model_terms:ir.ui.view,arch_db:pms.pms_property_views_form msgid "City" msgstr "" @@ -1908,6 +1914,7 @@ msgstr "" #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_property__country_id +#: model_terms:ir.ui.view,arch_db:pms.pms_property_views_form msgid "Country" msgstr "" @@ -2586,12 +2593,12 @@ msgid "Document Type" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Document number" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Document number:" msgstr "" @@ -2755,7 +2762,7 @@ msgid "Enter" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Entry date" msgstr "" @@ -2789,7 +2796,7 @@ msgid "Exit" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Exit date" msgstr "" @@ -2799,7 +2806,7 @@ msgid "Expedition Date" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Expedition date" msgstr "" @@ -3247,7 +3254,7 @@ msgstr "" #: model:ir.model.fields,field_description:pms.field_pms_checkin_partner__gender #: model:ir.model.fields,field_description:pms.field_pms_property__gender #: model:ir.model.fields,field_description:pms.field_res_partner__gender -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Gender" msgstr "" @@ -3866,6 +3873,11 @@ msgstr "" msgid "Internal comment for folio" msgstr "" +#. module: pms +#: model:ir.model.fields,help:pms.field_pms_reservation__check_adults +msgid "Internal field to force room capacity validations" +msgstr "" + #. module: pms #: model:ir.model.fields,help:pms.field_pms_folio__partner_internal_comment #: model:ir.model.fields,help:pms.field_pms_reservation__partner_internal_comment @@ -4403,7 +4415,7 @@ msgid "" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Lastnames" msgstr "" @@ -4736,7 +4748,7 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:pms.availability_view_form #: model_terms:ir.ui.view,arch_db:pms.pms_room_view_form #: model_terms:ir.ui.view,arch_db:pms.pms_shared_room_view_form -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Name" msgstr "" @@ -5282,7 +5294,7 @@ msgid "Overbookings" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "PART OF TRAVELERS ENTRY" msgstr "" @@ -5550,13 +5562,7 @@ msgid "Persons" msgstr "" #. module: pms -#: code:addons/pms/models/pms_reservation_line.py:0 -#, python-format -msgid "Persons can't be higher than room capacity" -msgstr "" - -#. module: pms -#: code:addons/pms/models/pms_reservation.py:0 +#: code:addons/pms/models/pms_room.py:0 #, python-format msgid "Persons can't be higher than room capacity (%s)" msgstr "" @@ -7500,6 +7506,7 @@ msgstr "" #: model:ir.model.fields,field_description:pms.field_res_partner__state_id #: model:ir.model.fields,field_description:pms.field_res_users__state_id #: model_terms:ir.ui.view,arch_db:pms.pms_checkin_partner_view_search +#: model_terms:ir.ui.view,arch_db:pms.pms_property_views_form #: model_terms:ir.ui.view,arch_db:pms.pms_reservation_view_search msgid "State" msgstr "" @@ -7549,6 +7556,16 @@ msgstr "" msgid "Street" msgstr "" +#. module: pms +#: model_terms:ir.ui.view,arch_db:pms.pms_property_views_form +msgid "Street 2..." +msgstr "" + +#. module: pms +#: model_terms:ir.ui.view,arch_db:pms.pms_property_views_form +msgid "Street..." +msgstr "" + #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_property__street2 msgid "Street2" @@ -7624,7 +7641,7 @@ msgid "System Parameter" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "TRAVELER'S DOCUMENT" msgstr "" @@ -8424,7 +8441,7 @@ msgid "Total amount" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Total amount (Reservation Card):" msgstr "" @@ -8503,7 +8520,7 @@ msgid "Transactions" msgstr "" #. module: pms -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Traveler's signature" msgstr "" @@ -8532,7 +8549,7 @@ msgstr "" #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_booking_engine__reservation_type #: model:ir.model.fields,field_description:pms.field_pms_folio__reservation_type -#: model_terms:ir.ui.view,arch_db:pms.report_viajero +#: model_terms:ir.ui.view,arch_db:pms.traveller_report msgid "Type" msgstr "" @@ -8920,6 +8937,11 @@ msgstr "" msgid "You must assign a customer name" msgstr "" +#. module: pms +#: model_terms:ir.ui.view,arch_db:pms.pms_property_views_form +msgid "ZIP" +msgstr "" + #. module: pms #: model:ir.model.fields,field_description:pms.field_pms_property__zip msgid "Zip" diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py index 38a3e006054..b24fc967550 100644 --- a/pms/models/pms_reservation.py +++ b/pms/models/pms_reservation.py @@ -342,7 +342,6 @@ class PmsReservation(models.Model): reservation_type = fields.Selection( string="Reservation Type", help="Type of reservations. It can be 'normal', 'staff' or 'out of service", - default=lambda *a: "normal", related="folio_id.reservation_type", store=True, readonly=False, @@ -605,6 +604,29 @@ class PmsReservation(models.Model): readonly=False, ) + check_adults = fields.Boolean( + help="Internal field to force room capacity validations", + compute="_compute_check_adults", + readonly=False, + store=True, + ) + + def _compute_date_order(self): + for record in self: + record.date_order = datetime.datetime.today() + + @api.depends( + "service_ids", + "service_ids.service_line_ids", + "service_ids.service_line_ids.product_id", + "service_ids.service_line_ids.day_qty", + "reservation_line_ids", + "reservation_line_ids.room_id", + ) + def _compute_check_adults(self): + for record in self: + record.check_adults = True + @api.depends( "checkin", "checkout", @@ -1423,23 +1445,6 @@ def check_consecutive_dates(self): # _("The room already is completed (%s)", record.name) # ) - @api.constrains("adults") - def _check_adults(self): - for record in self: - extra_bed = record.service_ids.filtered( - lambda r: r.product_id.is_extra_bed is True - ) - for room in record.reservation_line_ids.room_id: - if record.adults + record.children_occupying > room.get_capacity( - sum(extra_bed.mapped("product_qty")) - ): - raise ValidationError( - _( - "Persons can't be higher than room capacity (%s)", - record.name, - ) - ) - @api.constrains("state") def _check_onboard_reservation(self): for record in self: @@ -1484,6 +1489,13 @@ def _no_agency_as_agency(self): if record.agency_id and not record.agency_id.is_agency: raise ValidationError(_("booking agency with wrong configuration: ")) + @api.constrains("check_adults") + def _check_capacity(self): + for record in self: + self.env["pms.room"]._check_adults( + record, record.service_ids.service_line_ids + ) + # Action methods def open_partner(self): """ Utility method used to add an "View Customer" button in reservation views """ @@ -1623,6 +1635,12 @@ def create(self, vals): ) pms_property = self.env["pms.property"].browse(pms_property_id) vals["name"] = pms_property.reservation_sequence_id._next_do() + + if not vals.get("reservation_type"): + vals["reservation_type"] = ( + folio.reservation_type if folio.reservation_type else "normal" + ) + record = super(PmsReservation, self).create(vals) if record.preconfirm: record.confirm() diff --git a/pms/models/pms_reservation_line.py b/pms/models/pms_reservation_line.py index 3d5e2b641b7..6331997fae4 100644 --- a/pms/models/pms_reservation_line.py +++ b/pms/models/pms_reservation_line.py @@ -470,17 +470,3 @@ def constrains_duplicated_date(self): ) if duplicated: raise ValidationError(_("Duplicated reservation line date")) - - @api.constrains("room_id") - def _check_adults(self): - for record in self.filtered("room_id"): - extra_bed = record.reservation_id.service_ids.filtered( - lambda r: r.product_id.is_extra_bed is True - ) - if ( - record.reservation_id.adults + record.reservation_id.children_occupying - > record.room_id.get_capacity(len(extra_bed)) - ): - raise ValidationError(_("Persons can't be higher than room capacity")) - # if record.reservation_id.adults == 0: - # raise ValidationError(_("Reservation has no adults")) diff --git a/pms/models/pms_room.py b/pms/models/pms_room.py index e83742eac7b..dcb6869a052 100644 --- a/pms/models/pms_room.py +++ b/pms/models/pms_room.py @@ -118,6 +118,26 @@ def _check_capacity(self): ) ) + @api.model + def _check_adults(self, reservation, service_line_ids=False): + for line in reservation.reservation_line_ids: + num_extra_beds = 0 + if service_line_ids: + extra_beds = service_line_ids.filtered( + lambda x: x.date == line.date and x.product_id.is_extra_bed is True + ) + num_extra_beds = sum(extra_beds.mapped("day_qty")) if extra_beds else 0 + if line.room_id: + if ( + reservation.adults + reservation.children_occupying + ) > line.room_id.get_capacity(num_extra_beds): + raise ValidationError( + _( + "Persons can't be higher than room capacity (%s)", + reservation.name, + ) + ) + # Business methods def get_capacity(self, extra_bed=0): diff --git a/pms/models/pms_service.py b/pms/models/pms_service.py index 858c0cfa72b..af621271ae6 100644 --- a/pms/models/pms_service.py +++ b/pms/models/pms_service.py @@ -340,23 +340,24 @@ def _compute_service_line_ids(self): move_day = 0 if consumed_on == "after": move_day = 1 - service.service_line_ids -= ( - service.service_line_ids.filtered_domain( - [ - "|", - ( - "date", - "<", - reservation.checkin + timedelta(move_day), - ), - ( - "date", - ">=", - reservation.checkout + timedelta(move_day), - ), - ] - ) - ) + for del_service_id in service.service_line_ids.filtered_domain( + [ + "|", + ( + "date", + "<", + reservation.checkin + timedelta(move_day), + ), + ( + "date", + ">=", + reservation.checkout + timedelta(move_day), + ), + ] + ).ids: + lines.append((2, del_service_id)) + # TODO: check intermediate states in check_adults restriction + # when lines are removed service.service_line_ids = lines else: if not service.service_line_ids: @@ -535,10 +536,11 @@ def _get_real_price_currency(self, product, rule_id, qty, uom, pricelist_id): # Businness Methods def _service_day_qty(self): self.ensure_one() - qty = self.product_qty if len(self.service_line_ids) == 1 else 0 + qty = self.product_qty if len(self.service_line_ids) == 1 else 1 if not self.reservation_id: return qty # TODO: Pass per_person to service line from product default_per_person + # When the user modifies the quantity avoid overwriting if self.product_id.per_person: qty = self.reservation_id.adults return qty diff --git a/pms/report/traveller_report_action.xml b/pms/report/traveller_report_action.xml index 17388a536d2..f04c2bbdfb5 100644 --- a/pms/report/traveller_report_action.xml +++ b/pms/report/traveller_report_action.xml @@ -5,8 +5,8 @@ Traveller Report pms.checkin.partner qweb-pdf - pms.report_viajero - pms.report_viajero + pms.traveller_report + pms.traveller_report - +
+ + + + + + +
+
+ +
+
+
+
diff --git a/pms/views/pms_reservation_views.xml b/pms/views/pms_reservation_views.xml index af3fd4b9a6c..7fbe5382514 100644 --- a/pms/views/pms_reservation_views.xml +++ b/pms/views/pms_reservation_views.xml @@ -16,6 +16,7 @@ +