[IMP] website_event: display the timezone when a datetime is used
Cleanup all the places where an hour or a datetime is been used to display with the date the corresponding timezone. The goal is to know the timezone used where a datetime is displayed on the event pages. task-2458013 COM PR: odoo#78049 Part-of: odoo/odoo#78049
This commit is contained in:
@@ -126,7 +126,7 @@
|
||||
<td style="padding: 0px 10px 0px 10px;width:50%;line-height:20px;vertical-align:top;">
|
||||
<div><strong>From</strong> <t t-out="object.event_id.date_begin_located or ''">May 4, 2021, 7:00:00 AM</t></div>
|
||||
<div><strong>To</strong> <t t-out="object.event_id.date_end_located or ''">May 6, 2021, 5:00:00 PM</t></div>
|
||||
<div style="font-size:12px;color:#9e9e9e"><i><strong>TZ</strong> <t t-out="object.event_id.date_tz or ''">Europe/Brussels</t></i></div>
|
||||
<div style="font-size:12px;color:#9e9e9e"><i>(<t t-out="object.event_id.date_tz or ''">Europe/Brussels</t>)</i></div>
|
||||
</td>
|
||||
<td style="vertical-align:top;">
|
||||
<t t-if="event_address">
|
||||
@@ -353,7 +353,7 @@
|
||||
<td style="padding: 0px 10px 0px 10px;width:50%;line-height:20px;vertical-align:top;">
|
||||
<div><strong>From</strong> <t t-out="object.event_id.date_begin_located or ''">May 4, 2021, 7:00:00 AM</t></div>
|
||||
<div><strong>To</strong> <t t-out="object.event_id.date_end_located or ''">May 6, 2021, 5:00:00 PM</t></div>
|
||||
<div style="font-size:12px;color:#9e9e9e"><i><strong>TZ</strong> <t t-out="object.event_id.date_tz or ''">Europe/Brussels</t></i></div>
|
||||
<div style="font-size:12px;color:#9e9e9e"><i><t t-out="object.event_id.date_tz or ''">Europe/Brussels</t></i></div>
|
||||
</td>
|
||||
<td style="vertical-align:top;">
|
||||
<t t-if="event_address">
|
||||
|
||||
@@ -581,8 +581,8 @@ class EventEvent(models.Model):
|
||||
cal_event = cal.add('vevent')
|
||||
|
||||
cal_event.add('created').value = fields.Datetime.now().replace(tzinfo=pytz.timezone('UTC'))
|
||||
cal_event.add('dtstart').value = fields.Datetime.from_string(event.date_begin).replace(tzinfo=pytz.timezone('UTC'))
|
||||
cal_event.add('dtend').value = fields.Datetime.from_string(event.date_end).replace(tzinfo=pytz.timezone('UTC'))
|
||||
cal_event.add('dtstart').value = event.date_begin.astimezone(pytz.timezone(event.date_tz))
|
||||
cal_event.add('dtend').value = event.date_end.astimezone(pytz.timezone(event.date_tz))
|
||||
cal_event.add('summary').value = event.name
|
||||
if event.address_id:
|
||||
cal_event.add('location').value = event.sudo().address_id.contact_address
|
||||
|
||||
@@ -21,14 +21,17 @@
|
||||
class="font-weight-bold"/>
|
||||
<span itemprop="startDateTime" t-out="event.date_begin"
|
||||
class="font-weight-bold"
|
||||
t-options='{"widget": "datetime", "time_only": True, "hide_seconds": True}'/>
|
||||
t-options='{"widget": "datetime", "time_only": True, "tz_name": event.date_tz, "hide_seconds": True}'/>
|
||||
<span class="fa fa-arrow-right o_event_foldable_badge_font_faded"/>
|
||||
<span t-if="not event.is_one_day"
|
||||
itemprop="endDate" t-out="event.date_end.date()"
|
||||
class="font-weight-bold"/>
|
||||
<span itemprop="endDateTime" t-out="event.date_end"
|
||||
class="font-weight-bold"
|
||||
t-options='{"widget": "datetime", "time_only": True, "hide_seconds": True}'/>
|
||||
t-options='{"widget": "datetime", "time_only": True, "tz_name": event.date_tz, "hide_seconds": True}'/>
|
||||
</div>
|
||||
<div class="o_event_foldable_badge_font_faded o_event_foldable_badge_font_small text-center">
|
||||
(<span itemprop="timezone" t-out="event.date_tz"/>)
|
||||
</div>
|
||||
<div t-if="event.address_id" class="o_event_foldable_badge_font_faded o_event_foldable_badge_font_small text-center">
|
||||
<t t-call="event.event_report_template_formatted_event_address"/>
|
||||
@@ -119,14 +122,15 @@
|
||||
class="font-weight-bold"/>
|
||||
<span itemprop="startDateTime" t-out="event.date_begin"
|
||||
class="font-weight-bold"
|
||||
t-options='{"widget": "datetime", "time_only": True, "hide_seconds": True}'/>
|
||||
t-options='{"widget": "datetime", "time_only": True, "hide_seconds": True, "tz_name": event.date_tz}'/>
|
||||
<span class="fa fa-arrow-right o_event_full_page_ticket_font_faded"/>
|
||||
<span t-if="not event.is_one_day"
|
||||
itemprop="endDate" t-out="event.date_end.date()"
|
||||
class="font-weight-bold"/>
|
||||
<span itemprop="endDateTime" t-out="event.date_end"
|
||||
class="font-weight-bold"
|
||||
t-options='{"widget": "datetime", "time_only": True, "hide_seconds": True}'/>
|
||||
t-options='{"widget": "datetime", "time_only": True, "hide_seconds": True, "tz_name": event.date_tz}'/>
|
||||
<span itemprop="timeZone" class="o_event_full_page_ticket_font_faded small">(<t t-out="event.date_tz"/>)</span>
|
||||
<div t-if="event.address_id" class="o_event_full_page_ticket_font_faded">
|
||||
<t t-call="event.event_report_template_formatted_event_address"/>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ from dateutil.relativedelta import relativedelta
|
||||
import json
|
||||
import werkzeug.urls
|
||||
|
||||
from pytz import utc
|
||||
from pytz import utc, timezone
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons.http_routing.models.ir_http import slug
|
||||
@@ -407,12 +407,13 @@ class Event(models.Model):
|
||||
return super(Event, self)._track_subtype(init_values)
|
||||
|
||||
def _get_event_resource_urls(self):
|
||||
url_date_start = self.date_begin.strftime('%Y%m%dT%H%M%SZ')
|
||||
url_date_stop = self.date_end.strftime('%Y%m%dT%H%M%SZ')
|
||||
url_date_start = self.date_begin.astimezone(timezone(self.date_tz)).strftime('%Y%m%dT%H%M%S')
|
||||
url_date_stop = self.date_end.astimezone(timezone(self.date_tz)).strftime('%Y%m%dT%H%M%S')
|
||||
params = {
|
||||
'action': 'TEMPLATE',
|
||||
'text': self.name,
|
||||
'dates': url_date_start + '/' + url_date_stop,
|
||||
'ctz': self.date_tz,
|
||||
'details': self.name,
|
||||
}
|
||||
if self.address_id:
|
||||
|
||||
@@ -198,8 +198,11 @@
|
||||
</h5>
|
||||
<!-- Start Date & Time -->
|
||||
<time itemprop="startDate" t-att-datetime="event.date_begin">
|
||||
<span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'date_only': 'true', 'format': 'long'}"/> -
|
||||
<span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'time_only': 'true', 'format': 'short'}" class="oe_hide_on_date_edit"/>
|
||||
<span t-field="event.with_context(tz=event.date_tz).date_begin"
|
||||
t-options="{'date_only': 'true', 'format': 'long', 'tz_name': event.date_tz}"/> -
|
||||
<span t-field="event.with_context(tz=event.date_tz).date_begin" class="oe_hide_on_date_edit"
|
||||
t-options="{'time_only': 'true', 'format': 'short', 'tz_name': event.date_tz}"/>
|
||||
(<span t-field="event.date_tz"/>)
|
||||
</time>
|
||||
<!-- Location -->
|
||||
<div itemprop="location" t-field="event.address_id" t-options="{'widget': 'contact', 'fields': ['city'], 'no_marker': 'true'}"/>
|
||||
|
||||
@@ -50,8 +50,10 @@
|
||||
<t t-if="event.is_one_day">
|
||||
<i class="fa fa-long-arrow-right mx-1"/>
|
||||
<span t-field="event.with_context(tz=event.date_tz).date_end" t-options="{'time_only': 'true', 'format': 'short'}"/>
|
||||
(<span t-out="event.date_tz"/>)
|
||||
</t>
|
||||
<t t-else="">
|
||||
(<span t-out="event.date_tz"/>)
|
||||
<i class="fa fa-long-arrow-down d-block text-muted mx-3 my-2" style="font-size: 1.5rem"/>
|
||||
<div class="d-flex">
|
||||
<h5 t-field="event.with_context(tz=event.date_tz).date_end" class="my-1 mr-1 oe_hide_on_date_edit" t-options="{'date_only': 'true', 'format': 'EEEE'}"/>
|
||||
@@ -59,9 +61,8 @@
|
||||
</div>
|
||||
<t t-if="not event.is_one_day">End -</t>
|
||||
<span t-field="event.with_context(tz=event.date_tz).date_end" t-options="{'time_only': 'true', 'format': 'short'}"/>
|
||||
(<span t-out="event.date_tz"/>)
|
||||
</t>
|
||||
<!-- Timezone -->
|
||||
<small t-out="event.date_tz" class="d-block my-3 text-muted"/>
|
||||
|
||||
<div class="dropdown">
|
||||
<i class="fa fa-calendar mr-1"/>
|
||||
@@ -180,13 +181,13 @@
|
||||
class="text-muted mr-3" itemprop="availabilityEnds">Sales end on
|
||||
<span itemprop="priceValidUntil" t-out="ticket.end_sale_datetime"
|
||||
t-options="{'widget': 'datetime', 'tz_name': event.date_tz, 'format': 'short'}"/>
|
||||
<span t-out="ticket.event_id.date_tz"/>
|
||||
(<span t-out="ticket.event_id.date_tz"/>)
|
||||
</small>
|
||||
<small t-if="ticket.start_sale_datetime and not ticket.sale_available and not ticket.is_expired"
|
||||
class="text-muted mr-3" itemprop="availabilityEnds">
|
||||
Sales start on <span itemprop="priceValidUntil" t-out="ticket.start_sale_datetime"
|
||||
t-options="{'widget': 'datetime', 'tz_name': event.date_tz, 'format': 'short'}"/>
|
||||
<span t-out="ticket.event_id.date_tz"/>
|
||||
(<span t-out="ticket.event_id.date_tz"/>)
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-md-4 col-xs-12 p-0 d-flex align-items-center justify-content-between">
|
||||
@@ -228,10 +229,12 @@
|
||||
<span t-if="tickets" t-field="tickets.name"/>
|
||||
<span t-else="">Registration</span>
|
||||
</h6>
|
||||
<small t-if="tickets.end_sale_datetime and tickets.sale_available and not tickets.is_expired" class="text-muted mr-3" itemprop="availabilityEnds">Sales end on
|
||||
<small t-if="tickets.end_sale_datetime and tickets.sale_available and not tickets.is_expired"
|
||||
class="text-muted ml-1 mr-3" itemprop="availabilityEnds">
|
||||
Sales end on
|
||||
<span itemprop="priceValidUntil" t-out="tickets.end_sale_datetime"
|
||||
t-options="{'widget': 'datetime', 'tz_name': event.date_tz, 'format': 'short'}"/>
|
||||
<span t-out="tickets.event_id.date_tz"/>
|
||||
(<span t-out="tickets.event_id.date_tz"/>)
|
||||
</small>
|
||||
<t t-call="website_event.registration_configure_tickets_button"
|
||||
t-if="request.env.user.has_group('event.group_event_manager')"/>
|
||||
@@ -366,6 +369,7 @@
|
||||
</div>
|
||||
<div class="col pl-0">
|
||||
<span itemprop="startDate" t-out="event.date_begin_located"/>
|
||||
(<span t-out="event.date_tz"/>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -374,6 +378,7 @@
|
||||
</div>
|
||||
<div class="col pl-0">
|
||||
<span itemprop="endDate" t-out="event.date_end_located"/>
|
||||
(<span t-out="event.date_tz"/>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
|
||||
@@ -15,7 +15,7 @@ class WebsiteEventController(main.WebsiteEventController):
|
||||
if "from_sponsor_id" in post and not event.is_ongoing:
|
||||
sponsor = request.env["event.sponsor"].browse(int(post["from_sponsor_id"])).exists()
|
||||
if sponsor:
|
||||
date_begin = format_datetime(event.with_context(tz=event.date_tz).date_begin, format="medium")
|
||||
date_begin = format_datetime(event.date_begin, format="medium", tzinfo=event.date_tz)
|
||||
|
||||
values["toast_message"] = (
|
||||
_('The event %s starts on %s (%s). \nJoin us there to meet %s !')
|
||||
|
||||
@@ -65,9 +65,9 @@
|
||||
<span>Oops! This room is currently closed</span><br />
|
||||
Come back between
|
||||
<strong>
|
||||
<t t-out="sponsor.hour_from" t-options="{'widget': 'float_time'}"/>
|
||||
<t t-out="sponsor.hour_from" t-options="{'widget': 'time'}"/>
|
||||
-
|
||||
<t t-out="sponsor.hour_to" t-options="{'widget': 'float_time'}"/>
|
||||
<t t-out="sponsor.hour_to" t-options="{'widget': 'time'}"/>
|
||||
</strong> (<span t-out="sponsor.event_date_tz"/>)
|
||||
to meet them !
|
||||
</div>
|
||||
@@ -117,10 +117,10 @@
|
||||
<div t-if="sponsor.hour_from and sponsor.hour_to"
|
||||
t-att-class="'%s' % 'mb-3' if sponsor.hour_from and sponsor.hour_to else ''">
|
||||
Available from
|
||||
<t t-out="sponsor.hour_from" t-options="{'widget': 'float_time'}"/>
|
||||
<t t-out="sponsor.hour_from" t-options="{'widget': 'time'}"/>
|
||||
-
|
||||
<t t-out="sponsor.hour_to" t-options="{'widget': 'float_time'}"/>
|
||||
<span t-out="sponsor.event_date_tz"/>
|
||||
<t t-out="sponsor.hour_to" t-options="{'widget': 'time'}"/>
|
||||
(<span t-out="sponsor.event_date_tz"/>)
|
||||
</div>
|
||||
<div t-if="sponsor.url" class="d-flex text-break align-items-baseline">
|
||||
<i class="fa fa-home mr-2"/><a t-att-href="sponsor.url"><span t-field="sponsor.url"/></a>
|
||||
|
||||
@@ -15,7 +15,7 @@ class WebsiteEventController(main.WebsiteEventController):
|
||||
if "from_room_id" in post and not event.is_ongoing:
|
||||
meeting_room = request.env["event.meeting.room"].browse(int(post["from_room_id"])).sudo().exists()
|
||||
if meeting_room and meeting_room.is_published:
|
||||
date_begin = format_datetime(event.with_context(tz=event.date_tz).date_begin, format="medium")
|
||||
date_begin = format_datetime(event.date_begin, format="medium", tzinfo=event.date_tz)
|
||||
|
||||
values["toast_message"] = (
|
||||
_('The event %s starts on %s (%s). \nJoin us there to chat about "%s" !')
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
<span>This room is not open right now!</span><br />
|
||||
Join us here on the
|
||||
<strong itemprop="startDate" t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'medium'}"/>
|
||||
<strong>(<t t-out="event.date_tz"/>)</strong>
|
||||
to have a chat with us!
|
||||
</t>
|
||||
<t t-else="">
|
||||
@@ -177,7 +178,11 @@
|
||||
<div t-else="" class="d-flex flex-column">
|
||||
<button disabled="disabled" class="btn btn-primary align-self-start">Create a Room</button>
|
||||
Room creation will be available when event starts at
|
||||
<span class="font-weight-bold" t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'medium'}"/>
|
||||
<span>
|
||||
<span class="font-weight-bold" t-field="event.with_context(tz=event.date_tz).date_begin"
|
||||
t-options="{'format': 'medium'}"/>
|
||||
<span class="small">(<t t-out="event.date_tz"/>)</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
<span class="font-weight-bold" t-out="day"
|
||||
t-options="{'widget': 'date', 'format': 'YYYY'}"/>
|
||||
</div>
|
||||
<div class="flex-column align-self-center ml-2">
|
||||
<span class="small font-weight-light">(<t t-out="event.date_tz"/>)</span>
|
||||
</div>
|
||||
</div>
|
||||
<small class="float-right text-muted align-self-end"><t t-out="tracks_by_days[day]"/> tracks</small>
|
||||
</div>
|
||||
|
||||
@@ -182,6 +182,9 @@
|
||||
<span class="font-weight-bold" t-out="tracks_date"
|
||||
t-options="{'widget': 'date', 'format': 'YYYY'}"/>
|
||||
</div>
|
||||
<div class="flex-column align-self-center ml-2">
|
||||
<span class="small font-weight-light">(<t t-out="event.date_tz"/>)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-grow-1" t-elif="tracks_header_name">
|
||||
<span class="h1 m-0 font-weight-bold"
|
||||
@@ -203,7 +206,7 @@
|
||||
t-att-class="'o_wesession_list_item px-2 py-2 event_color_%d' % (track.color)">
|
||||
<!-- Side information in a floating div (desktop only) -->
|
||||
<div t-if="not event.is_done and (not track.date or today_tz <= tracks_date) and option_track_wishlist"
|
||||
class="float-right d-none d-md-block ml-2">
|
||||
class="float-right d-none d-md-block ml-2 py-1">
|
||||
<t t-call="website_event_track.track_widget_reminder">
|
||||
<t t-set="reminder_small" t-value="False"/>
|
||||
<t t-set="reminder_light" t-value="False"/>
|
||||
@@ -214,7 +217,7 @@
|
||||
<div class="col-md-7">
|
||||
<!-- Reminder widget: directly in line to gain space, mobile only -->
|
||||
<div t-if="not event.is_done and (not track.date or today_tz <= tracks_date) and option_track_wishlist"
|
||||
class="float-right d-block d-md-none ml-2">
|
||||
class="float-right d-block d-md-none ml-2 py-1">
|
||||
<t t-call="website_event_track.track_widget_reminder">
|
||||
<t t-set="reminder_small" t-value="True"/>
|
||||
<t t-set="reminder_light" t-value="False"/>
|
||||
@@ -251,7 +254,7 @@
|
||||
<span t-elif="not track.is_track_done and not track.is_track_soon"
|
||||
class="ml-2"
|
||||
t-out="track.date"
|
||||
t-options="{'widget': 'datetime', 'time_only': True, 'format': 'short'}"/>
|
||||
t-options="{'widget': 'datetime', 'time_only': True, 'format': 'short', 'tz_name': track.event_id.date_tz}"/>
|
||||
<span t-else="" class="badge badge-info ml-2">Finished</span>
|
||||
</div>
|
||||
<!-- Duration (desktop only) -->
|
||||
@@ -265,7 +268,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Aside column: date, tags -->
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-5 align-self-center">
|
||||
<!-- Hour: Live > Remaining > Hour: desktop only -->
|
||||
<div t-if="tracks_date and today_tz <= tracks_date"
|
||||
class="d-none d-md-block float-right">
|
||||
@@ -280,7 +283,7 @@
|
||||
<span t-elif="not track.is_track_done and not track.is_track_soon"
|
||||
class="ml-2"
|
||||
t-out="track.date"
|
||||
t-options="{'widget': 'datetime', 'time_only': True, 'format': 'short'}"/>
|
||||
t-options="{'widget': 'datetime', 'time_only': True, 'format': 'short', 'tz_name': event.date_tz}"/>
|
||||
<span t-else="" class="badge badge-info ml-2">Finished</span>
|
||||
</div>
|
||||
<!-- Tags: desktop only -->
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
<span t-else="">
|
||||
starts on
|
||||
<span t-field="track.event_id.with_context(tz=track.event_id.date_tz).date_begin"
|
||||
t-options="{'format': 'long', 'tz_name': track.event_id.date_tz, 'hide_seconds': True}"/>
|
||||
t-options="{'format': 'medium', 'tz_name': track.event_id.date_tz, 'hide_seconds': 'True'}"/>
|
||||
(<span t-out="track.event_id.date_tz"/>)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,12 +86,12 @@
|
||||
</t>
|
||||
<t t-if="track.date">
|
||||
<span t-field="track.date"
|
||||
t-options='{"hide_seconds":"True", "format": "short"}'/>
|
||||
t-options='{"hide_seconds":"True", "format": "short", "tz_name": event.date_tz}'/>
|
||||
-
|
||||
<span t-field="track.date_end"
|
||||
t-options='{"hide_seconds":"True", "format": "short"}'/>
|
||||
t-options='{"hide_seconds":"True", "format": "short", "tz_name": event.date_tz}'/>
|
||||
<t t-if="event.date_tz">
|
||||
(<span t-field="track.date_end" t-options='{"format": "zzz"}'/>)
|
||||
(<span t-out="event.date_tz"/>)
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="track.duration">
|
||||
|
||||
Reference in New Issue
Block a user