From a4548a1b597228ebdc51e8506a3a1a40ab9516ce Mon Sep 17 00:00:00 2001 From: Carolina Fernandez Date: Fri, 20 Oct 2023 13:06:10 -0300 Subject: [PATCH] [15.0][ADD] resource_boooking: Add meeting url in resource booking TT45337 --- resource_booking/i18n/es.po | 99 +++++++++---------- resource_booking/i18n/resource_booking.pot | 21 ++-- resource_booking/models/resource_booking.py | 22 +++++ .../models/resource_booking_type.py | 1 + resource_booking/templates/portal.xml | 9 ++ resource_booking/tests/common.py | 1 + resource_booking/tests/test_backend.py | 45 +++++++++ resource_booking/tests/test_portal.py | 11 +++ .../views/resource_booking_type_views.xml | 1 + .../views/resource_booking_views.xml | 1 + 10 files changed, 149 insertions(+), 62 deletions(-) diff --git a/resource_booking/i18n/es.po b/resource_booking/i18n/es.po index a2dc91e5..231cadd4 100644 --- a/resource_booking/i18n/es.po +++ b/resource_booking/i18n/es.po @@ -1,21 +1,19 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * resource_booking +# * resource_booking # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-04-30 10:28+0000\n" -"PO-Revision-Date: 2021-04-30 11:29+0100\n" -"Last-Translator: Jairo Llopis \n" +"POT-Creation-Date: 2023-10-20 15:55+0000\n" +"PO-Revision-Date: 2023-10-20 15:55+0000\n" +"Last-Translator: \n" "Language-Team: \n" -"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" #. module: resource_booking #: code:addons/resource_booking/models/resource_booking.py:0 @@ -142,6 +140,11 @@ msgstr "" msgid "Location:" msgstr "Ubicación:" +#. module: resource_booking +#: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form +msgid "Meeting URL:" +msgstr "" + #. module: resource_booking #: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form msgid "Requested by:" @@ -303,7 +306,7 @@ msgstr "Reservas/citas disponibles para este tipo" #. module: resource_booking #: model:ir.model,name:resource_booking.model_calendar_event msgid "Calendar Event" -msgstr "" +msgstr "Evento de calendario" #. module: resource_booking #: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_form @@ -324,8 +327,7 @@ msgid "" "\n" "- %s" msgstr "" -"No se pueden agendar estas reservas/citas porque no se les han seleccionado " -"recursos:\n" +"No se pueden agendar estas reservas/citas porque no se les han seleccionado recursos:\n" "\n" "- %s" @@ -333,22 +335,19 @@ msgstr "" #: code:addons/resource_booking/models/resource_booking.py:0 #, python-format msgid "" -"Cannot schedule these bookings because they do not fit in their type or " -"resources calendars, or because all resources are busy:\n" +"Cannot schedule these bookings because they do not fit in their type or resources calendars, or because all resources are busy:\n" "\n" "- %s" msgstr "" -"No se pueden agendar estas reservas/citas porque no encajan en los " -"calendarios de sus tipos o recursos, o porque todos sus recursos están " -"ocupados:\n" +"No se pueden agendar estas reservas/citas porque no encajan en los calendarios de sus tipos o recursos, o porque todos sus recursos están ocupados:\n" "\n" "- %s" #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking_type__combination_assignment msgid "" -"Choose how to auto-assign resource combinations. It has no effect if assiged " -"manually." +"Choose how to auto-assign resource combinations. It has no effect if assiged" +" manually." msgstr "" "Escoja cómo autoasignar combinaciones de recursos. No tendrá efecto si se " "asigna manualmente." @@ -584,9 +583,7 @@ msgstr "Si está marcado, hay nuevos mensajes que requieren de su atención." #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking__message_has_error -#: model:ir.model.fields,help:resource_booking.field_resource_booking__message_has_sms_error #: model:ir.model.fields,help:resource_booking.field_resource_booking_type__message_has_error -#: model:ir.model.fields,help:resource_booking.field_resource_booking_type__message_has_sms_error msgid "If checked, some messages have a delivery error." msgstr "Si está marcado, algunos mensajes no se pudieron entregar." @@ -695,6 +692,12 @@ msgstr "" msgid "Meeting" msgstr "Reunión" +#. module: resource_booking +#: model:ir.model.fields,field_description:resource_booking.field_resource_booking__videocall_location +#: model:ir.model.fields,field_description:resource_booking.field_resource_booking_type__videocall_location +msgid "Meeting URL" +msgstr "" + #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking__meeting_id msgid "Meeting confirmed for this booking." @@ -835,8 +838,8 @@ msgstr "Solo puede existir un evento por reserva de recursos." #: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_form msgid "Open a calendar to schedule a meeting for this booking request." msgstr "" -"Abrir un calendario para agendar una reunión para esta solicitud de reserva/" -"cita." +"Abrir un calendario para agendar una reunión para esta solicitud de " +"reserva/cita." #. module: resource_booking #: model:ir.model.fields,field_description:resource_booking.field_resource_booking__user_id @@ -859,8 +862,7 @@ msgid "" msgstr "" "Pendiente: No se ha agendado ninguna reunión.\n" "Agendada: El solicitante todavía no ha confirmado su asistencia.\n" -"Confirmada: La reunión ha sido agendada, y el solicitante ha confirmado su " -"asistencia.\n" +"Confirmada: La reunión ha sido agendada, y el solicitante ha confirmado su asistencia.\n" "Cancelada: La reunión se ha borrado y la reserva/cita se ha archivado." #. module: resource_booking @@ -923,7 +925,7 @@ msgstr "" #. module: resource_booking #: model:ir.model,name:resource_booking.model_resource_calendar msgid "Resource Working Time" -msgstr "Horario de trabajo del recurso" +msgstr "Tiempo de Trabajo de Recursos" #. module: resource_booking #: model:ir.model.fields,field_description:resource_booking.field_calendar_event__resource_booking_ids @@ -986,12 +988,6 @@ msgstr "Usuario responsable" msgid "Restrict bookings to this schedule." msgstr "Restringir reservas/citas a este horario." -#. module: resource_booking -#: model:ir.model.fields,field_description:resource_booking.field_resource_booking__message_has_sms_error -#: model:ir.model.fields,field_description:resource_booking.field_resource_booking_type__message_has_sms_error -msgid "SMS Delivery error" -msgstr "" - #. module: resource_booking #: model_terms:ir.ui.view,arch_db:resource_booking.portal_breadcrumbs #: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_form @@ -1100,11 +1096,11 @@ msgstr "Etiquetas" #: model:ir.model.fields,help:resource_booking.field_resource_booking__requester_advice #: model:ir.model.fields,help:resource_booking.field_resource_booking_type__requester_advice msgid "" -"Text that will appear by default in portal invitation emails and in calendar " -"views for scheduling." +"Text that will appear by default in portal invitation emails and in calendar" +" views for scheduling." msgstr "" -"Texto que aparecerá por defecto en los correos electrónicos de invitación al " -"portal y en las vistas de calendario para agendar." +"Texto que aparecerá por defecto en los correos electrónicos de invitación al" +" portal y en las vistas de calendario para agendar." #. module: resource_booking #: model_terms:ir.ui.view,arch_db:resource_booking.portal_my_bookings @@ -1115,8 +1111,8 @@ msgstr "Actualmente no hay reservas/citas en su cuenta." #: model_terms:ir.actions.act_window,help:resource_booking.resource_booking_type_action msgid "" "These records categorize resource bookings and apply restrictions to them, " -"such as available resource combinations, availability schedules and interval " -"duration." +"such as available resource combinations, availability schedules and interval" +" duration." msgstr "" "Estos registros categorizan las reservas/citas de recursos y les aplican " "restricciones, como combinaciones de recursos disponibles, horarios de " @@ -1238,8 +1234,8 @@ msgstr "Historial de comunicaciones del sitio web" #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking__combination_auto_assign msgid "" -"When checked, resource combinations will be (un)assigned automatically based " -"on their availability during the booking dates." +"When checked, resource combinations will be (un)assigned automatically based" +" on their availability during the booking dates." msgstr "" #. module: resource_booking @@ -1249,18 +1245,18 @@ msgid "" "requester didn't place the booking yet." msgstr "" "Cuando esté agendada, los recursos estarán bloqueados. Cuando esté " -"pendiente, significa que el solicitante todavía no ha agendado su reserva/" -"cita." +"pendiente, significa que el solicitante todavía no ha agendado su " +"reserva/cita." #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking_type__modifications_deadline msgid "" -"When this deadline has been exceeded, if a booking was not yet confirmed, it " -"will be canceled automatically. Also, only booking managers will be able to " -"unschedule or reschedule them. The value is expressed in hours." +"When this deadline has been exceeded, if a booking was not yet confirmed, it" +" will be canceled automatically. Also, only booking managers will be able to" +" unschedule or reschedule them. The value is expressed in hours." msgstr "" -"Cuando esta fecha límite se haya sobrepasado, si una reserva/cita todavía no " -"se había confirmado, será cancelada automáticamente. También, solo los " +"Cuando esta fecha límite se haya sobrepasado, si una reserva/cita todavía no" +" se había confirmado, será cancelada automáticamente. También, solo los " "responsables de reservas/citas podrán desagendarla o reagendarla. El valor " "se expresa en horas." @@ -1291,13 +1287,11 @@ msgstr "Está a punto de confirmar esta reserva/cita:" #: code:addons/resource_booking/models/calendar_event.py:0 #, python-format msgid "" -"You are not allowed to alter these bookings because they exceeded their " -"modification deadlines:\n" +"You are not allowed to alter these bookings because they exceeded their modification deadlines:\n" "\n" "- %s" msgstr "" -"No puede alterar estas reservas/citas porque han sobrepasado su fecha límite " -"de modificaciones:\n" +"No puede alterar estas reservas/citas porque han sobrepasado su fecha límite de modificaciones:\n" "\n" "- %s" @@ -1305,6 +1299,3 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:resource_booking.message_combination_assigned msgid "because you belong to the chosen resource combination:" msgstr "" - -#~ msgid "Followers (Channels)" -#~ msgstr "Seguidores (canales)" diff --git a/resource_booking/i18n/resource_booking.pot b/resource_booking/i18n/resource_booking.pot index 7500b5a7..1d522bda 100644 --- a/resource_booking/i18n/resource_booking.pot +++ b/resource_booking/i18n/resource_booking.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-20 15:09+0000\n" +"PO-Revision-Date: 2023-10-20 15:09+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -126,6 +128,11 @@ msgstr "" msgid "Location:" msgstr "" +#. module: resource_booking +#: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form +msgid "Meeting URL:" +msgstr "" + #. module: resource_booking #: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form msgid "Requested by:" @@ -554,9 +561,7 @@ msgstr "" #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking__message_has_error -#: model:ir.model.fields,help:resource_booking.field_resource_booking__message_has_sms_error #: model:ir.model.fields,help:resource_booking.field_resource_booking_type__message_has_error -#: model:ir.model.fields,help:resource_booking.field_resource_booking_type__message_has_sms_error msgid "If checked, some messages have a delivery error." msgstr "" @@ -665,6 +670,12 @@ msgstr "" msgid "Meeting" msgstr "" +#. module: resource_booking +#: model:ir.model.fields,field_description:resource_booking.field_resource_booking__videocall_location +#: model:ir.model.fields,field_description:resource_booking.field_resource_booking_type__videocall_location +msgid "Meeting URL" +msgstr "" + #. module: resource_booking #: model:ir.model.fields,help:resource_booking.field_resource_booking__meeting_id msgid "Meeting confirmed for this booking." @@ -948,12 +959,6 @@ msgstr "" msgid "Restrict bookings to this schedule." msgstr "" -#. module: resource_booking -#: model:ir.model.fields,field_description:resource_booking.field_resource_booking__message_has_sms_error -#: model:ir.model.fields,field_description:resource_booking.field_resource_booking_type__message_has_sms_error -msgid "SMS Delivery error" -msgstr "" - #. module: resource_booking #: model_terms:ir.ui.view,arch_db:resource_booking.portal_breadcrumbs #: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_form diff --git a/resource_booking/models/resource_booking.py b/resource_booking/models/resource_booking.py index 95911740..52e35a70 100644 --- a/resource_booking/models/resource_booking.py +++ b/resource_booking/models/resource_booking.py @@ -1,5 +1,6 @@ # Copyright 2021 Tecnativa - Jairo Llopis # Copyright 2022 Tecnativa - Pedro M. Baeza +# Copyright 2023 Tecnativa - Carolina Fernandez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import calendar @@ -151,6 +152,12 @@ class ResourceBooking(models.Model): readonly=False, store=True, ) + videocall_location = fields.Char( + compute="_compute_videocall_location", + string="Meeting URL", + readonly=False, + store=True, + ) requester_advice = fields.Text(related="type_id.requester_advice", readonly=True) is_modifiable = fields.Boolean(compute="_compute_is_modifiable") is_overdue = fields.Boolean(compute="_compute_is_overdue") @@ -271,6 +278,20 @@ def _compute_location(self): elif record.meeting_id: record.location = record.meeting_id.location + @api.depends("meeting_id.videocall_location", "type_id") + def _compute_videocall_location(self): + """Get videocall location from meeting or type.""" + for record in self: + # Get videocall_location from type when changing it or creating from ORM + if ( + not record.videocall_location + or record._origin.type_id != record.type_id + ): + record.videocall_location = record.type_id.videocall_location + # Get it from meeting only when available + elif record.meeting_id: + record.videocall_location = record.meeting_id.videocall_location + @api.depends("active", "meeting_id.attendee_ids.state") def _compute_state(self): """Obtain request state.""" @@ -340,6 +361,7 @@ def _prepare_meeting_vals(self): description=self.type_id.requester_advice, duration=self.duration, location=self.location, + videocall_location=self.videocall_location, name=self.name or self._get_name_formatted(self.partner_id, self.type_id), partner_ids=[ (4, partner.id, 0) for partner in self.partner_id | resource_partners diff --git a/resource_booking/models/resource_booking_type.py b/resource_booking/models/resource_booking_type.py index 077a5045..d43f25a9 100644 --- a/resource_booking/models/resource_booking_type.py +++ b/resource_booking/models/resource_booking_type.py @@ -65,6 +65,7 @@ class ResourceBookingType(models.Model): ), ) location = fields.Char() + videocall_location = fields.Char(string="Meeting URL") modifications_deadline = fields.Float( required=True, default=24, diff --git a/resource_booking/templates/portal.xml b/resource_booking/templates/portal.xml index 3126b1fa..648cbb1b 100644 --- a/resource_booking/templates/portal.xml +++ b/resource_booking/templates/portal.xml @@ -369,6 +369,15 @@ Location: +
+ Meeting URL: + + + +
Dates: diff --git a/resource_booking/tests/common.py b/resource_booking/tests/common.py index 335e6e4c..1bf5e4bb 100644 --- a/resource_booking/tests/common.py +++ b/resource_booking/tests/common.py @@ -130,6 +130,7 @@ def create_test_data(obj): ], "resource_calendar_id": obj.r_calendars[2].id, "location": "Main office", + "videocall_location": "Videocall Main office", } ) # Create some partner diff --git a/resource_booking/tests/test_backend.py b/resource_booking/tests/test_backend.py index 88ae41fb..56a5c695 100644 --- a/resource_booking/tests/test_backend.py +++ b/resource_booking/tests/test_backend.py @@ -607,6 +607,51 @@ def test_location(self): self.assertFalse(rb.meeting_id) self.assertEqual(rb.location, "Office 3") + def test_videocall_location(self): + """Videocall location across records works as expected.""" + rbt2 = self.rbt.copy({"videocall_location": "Videocall Office 2"}) + rb_f = Form(self.env["resource.booking"]) + rb_f.partner_id = self.partner + rb_f.type_id = self.rbt + rb = rb_f.save() + # Pending booking inherits videocall location from type + self.assertEqual(rb.state, "pending") + self.assertEqual(rb.videocall_location, "Videocall Main office") + # Booking can change videocall location independently now + with Form(rb) as rb_f: + rb_f.videocall_location = "Videocall Office 3" + self.assertEqual(self.rbt.videocall_location, "Videocall Main office") + self.assertEqual(rb.videocall_location, "Videocall Office 3") + # Changing booking type changes videocall location + with Form(rb) as rb_f: + rb_f.type_id = rbt2 + self.assertEqual(rb.videocall_location, "Videocall Office 2") + # Still can change it independently + with Form(rb) as rb_f: + rb_f.videocall_location = "Videocall Office 1" + self.assertEqual(rb.videocall_location, "Videocall Office 1") + self.assertEqual(rbt2.videocall_location, "Videocall Office 2") + # Schedule the booking, meeting inherits videocall location from it + with Form(rb) as rb_f: + rb_f.start = "2021-03-01 08:00:00" + self.assertEqual(rb.state, "scheduled") + self.assertEqual(rb.videocall_location, "Videocall Office 1") + self.assertEqual(rb.meeting_id.videocall_location, "Videocall Office 1") + # Changing meeting videocall location changes videocall location of booking + with Form(rb.meeting_id) as meeting_f: + meeting_f.videocall_location = "Videocall Office 2" + self.assertEqual(rb.videocall_location, "Videocall Office 2") + self.assertEqual(rb.meeting_id.videocall_location, "Videocall Office 2") + # Changing booking videocall location changes meeting location + with Form(rb) as rb_f: + rb_f.videocall_location = "Videocall Office 3" + self.assertEqual(rb.meeting_id.videocall_location, "Videocall Office 3") + self.assertEqual(rb.videocall_location, "Videocall Office 3") + # When unscheduled, it keeps videocall location untouched + rb.action_unschedule() + self.assertFalse(rb.meeting_id) + self.assertEqual(rb.videocall_location, "Videocall Office 3") + def test_organizer_sync(self): """Resource booking and meeting organizers are properly synced.""" rb = self.env["resource.booking"].create( diff --git a/resource_booking/tests/test_portal.py b/resource_booking/tests/test_portal.py index 8317959c..99a03dc5 100644 --- a/resource_booking/tests/test_portal.py +++ b/resource_booking/tests/test_portal.py @@ -71,6 +71,7 @@ def test_portal_scheduling_conflict(self): "partner_id": self.partner.id, "type_id": self.rbt.id, "location": "Office 2", + "videocall_location": "Videocall Office 2", }, ] ) @@ -86,6 +87,11 @@ def test_portal_scheduling_conflict(self): self.assertTrue( portal_page.cssselect(':contains("Location:") + :contains("Main office")') ) + self.assertTrue( + portal_page.cssselect( + ':contains("Meeting URL:") + :contains("Videocall Main office")' + ) + ) link = portal_page.cssselect('a:contains("Schedule")')[0] portal_url = link.get("href") portal_page = self._url_xml(portal_url) @@ -118,6 +124,11 @@ def test_portal_scheduling_conflict(self): self.assertTrue( public_page.cssselect(':contains("Location:") + :contains("Office 2")') ) + self.assertTrue( + public_page.cssselect( + ':contains("Meeting URL:") + :contains("Videocall Office 2")' + ) + ) self.assertTrue(public_page.cssselect('.badge:contains("Pending")')) link = public_page.cssselect('a:contains("Schedule")')[0] public_url = link.get("href") diff --git a/resource_booking/views/resource_booking_type_views.xml b/resource_booking/views/resource_booking_type_views.xml index cf33a750..bc00b278 100644 --- a/resource_booking/views/resource_booking_type_views.xml +++ b/resource_booking/views/resource_booking_type_views.xml @@ -45,6 +45,7 @@ + +