Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] event: display date of date_begin in the right tz #166071

Closed

Conversation

jorenvo
Copy link
Contributor

@jorenvo jorenvo commented May 17, 2024

The date on an event ticket can be wrong. To reproduce, create an event with a date_begin datetime that falls on the next UTC day. For example, specifying 2024-05-23 18:30 with the user's timezone as America/Los_Angeles results in a stored UTC time of 2024-05-24 01:30:00 (next day). Make sure the timezone of the public user is unset for simplicity's sake (it will fall back on that timezone), and then register for the event in an incognito window through the website. After registering, click "Download Tickets". The ticket PDF will display the UTC date.

The event_registration_report_template_full_page_ticket wrapper sets the timezone in context:

But ir.qweb.field.datetime doesn't use the record with attached context and only looks directly at the value. To make it work, tz_name must be specified explicitly. This is already done for the time part of date_begin below.

opw-3930916

The date on an event ticket can be wrong. To reproduce, create an
event with a date_begin datetime that falls on the next UTC day. For
example, specifying 2024-05-23 18:30 with the user's timezone as
America/Los_Angeles results in a stored UTC time of 2024-05-24
01:30:00 (next day). Make sure the timezone of the public user is
unset for simplicity's sake (it will fall back on that timezone), and
then register for the event in an incognito window through the
website. After registering, click "Download Tickets". The ticket PDF
will display the UTC date.

The event_registration_report_template_full_page_ticket wrapper sets
the timezone in context:

<t t-set="event" t-value="attendee.event_id._set_tz_context()"/>

But ir.qweb.field.datetime doesn't use the record with attached
context and only looks directly at the value. To make it work, tz_name
must be specified explicitly. This is already done for the time part
of date_begin below.

opw-3930916
@robodoo
Copy link
Contributor

robodoo commented May 17, 2024

Pull request status dashboard.

@C3POdoo C3POdoo requested a review from a team May 17, 2024 20:05
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label May 17, 2024
@Odoonan
Copy link
Contributor

Odoonan commented May 22, 2024

LGTM! the tz_name will indeed be used in value_to_html, setting the correct value in context_timestamp before formatting.

@Odoonan Odoonan changed the title [FIX] event: display date part of date_begin in the right timezone [FIX] event: display date of date_begin in the right tz May 22, 2024
@jorenvo
Copy link
Contributor Author

jorenvo commented May 22, 2024

@Odoonan thanks for checking! Can you r+ it? I don't have the rights.

@Odoonan
Copy link
Contributor

Odoonan commented May 22, 2024

@jeh-odoo Oy, can I get a delegate here? Cheers!

@jeh-odoo
Copy link
Contributor

@robodoo delegate=@Odoonan
You now have the power!

@Odoonan
Copy link
Contributor

Odoonan commented May 23, 2024

@robodoo r+

robodoo pushed a commit that referenced this pull request May 23, 2024
The date on an event ticket can be wrong. To reproduce, create an
event with a date_begin datetime that falls on the next UTC day. For
example, specifying 2024-05-23 18:30 with the user's timezone as
America/Los_Angeles results in a stored UTC time of 2024-05-24
01:30:00 (next day). Make sure the timezone of the public user is
unset for simplicity's sake (it will fall back on that timezone), and
then register for the event in an incognito window through the
website. After registering, click "Download Tickets". The ticket PDF
will display the UTC date.

The event_registration_report_template_full_page_ticket wrapper sets
the timezone in context:

<t t-set="event" t-value="attendee.event_id._set_tz_context()"/>

But ir.qweb.field.datetime doesn't use the record with attached
context and only looks directly at the value. To make it work, tz_name
must be specified explicitly. This is already done for the time part
of date_begin below.

opw-3930916

closes #166071

Signed-off-by: Noé Antoine (nan) <nan@odoo.com>
@robodoo robodoo closed this in cf34acf May 23, 2024
@jorenvo
Copy link
Contributor Author

jorenvo commented May 23, 2024

@Odoonan thanks!

lohwswilson pushed a commit to lohwswilson/odoo that referenced this pull request Jun 5, 2024
The date on an event ticket can be wrong. To reproduce, create an
event with a date_begin datetime that falls on the next UTC day. For
example, specifying 2024-05-23 18:30 with the user's timezone as
America/Los_Angeles results in a stored UTC time of 2024-05-24
01:30:00 (next day). Make sure the timezone of the public user is
unset for simplicity's sake (it will fall back on that timezone), and
then register for the event in an incognito window through the
website. After registering, click "Download Tickets". The ticket PDF
will display the UTC date.

The event_registration_report_template_full_page_ticket wrapper sets
the timezone in context:

<t t-set="event" t-value="attendee.event_id._set_tz_context()"/>

But ir.qweb.field.datetime doesn't use the record with attached
context and only looks directly at the value. To make it work, tz_name
must be specified explicitly. This is already done for the time part
of date_begin below.

opw-3930916

closes odoo#166071

Signed-off-by: Noé Antoine (nan) <nan@odoo.com>
@fw-bot fw-bot deleted the 17.0-event-date-timezone-opw-3930916-jov branch June 6, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants