Skip to content

Commit

Permalink
Merge PR #107 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 30, 2023
2 parents e33f389 + a4548a1 commit ea2f403
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 46 deletions.
91 changes: 45 additions & 46 deletions resource_booking/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>\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
Expand Down Expand Up @@ -142,6 +140,11 @@ msgstr ""
msgid "<strong>Location:</strong>"
msgstr "<strong>Ubicación:</strong>"

#. module: resource_booking
#: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form
msgid "<strong>Meeting URL:</strong>"
msgstr ""

#. module: resource_booking
#: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form
msgid "<strong>Requested by:</strong>"
Expand Down Expand Up @@ -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
Expand All @@ -324,31 +327,27 @@ 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"

#. module: resource_booking
#: 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."
Expand Down Expand Up @@ -693,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."
Expand Down Expand Up @@ -833,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
Expand All @@ -857,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
Expand Down Expand Up @@ -921,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
Expand Down Expand Up @@ -1092,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
Expand All @@ -1107,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 "
Expand Down Expand Up @@ -1230,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
Expand All @@ -1241,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."

Expand Down Expand Up @@ -1283,20 +1287,15 @@ 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"

#. module: resource_booking
#: 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)"
13 changes: 13 additions & 0 deletions resource_booking/i18n/resource_booking.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -126,6 +128,11 @@ msgstr ""
msgid "<strong>Location:</strong>"
msgstr ""

#. module: resource_booking
#: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form
msgid "<strong>Meeting URL:</strong>"
msgstr ""

#. module: resource_booking
#: model_terms:ir.ui.view,arch_db:resource_booking.resource_booking_portal_form
msgid "<strong>Requested by:</strong>"
Expand Down Expand Up @@ -663,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."
Expand Down
22 changes: 22 additions & 0 deletions resource_booking/models/resource_booking.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions resource_booking/models/resource_booking_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions resource_booking/templates/portal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,15 @@
<strong>Location:</strong>
<span t-field="booking_sudo.location" />
</div>
<div class="mb-1">
<strong>Meeting URL:</strong>
<a
t-att-href="booking_sudo.videocall_location"
target="_blank"
>
<t t-out="booking_sudo.videocall_location or ''" />
</a>
</div>
<div class="mb-1">
<strong>Dates:</strong>
<span t-field="booking_sudo.meeting_id.display_time" />
Expand Down
1 change: 1 addition & 0 deletions resource_booking/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions resource_booking/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading

0 comments on commit ea2f403

Please sign in to comment.