From 894229c26855fc177d223f7736ce5ffb2b773cde Mon Sep 17 00:00:00 2001 From: RomainLibert Date: Tue, 23 Jan 2018 17:48:21 +0100 Subject: [PATCH] [FIX] resource: Fix annoying bug with timezones When encoding global leaves, we put the timezone of this particular leave to False, which raises an exception when given directly to pytz. Simple solution is to pass 'UTC' in case we receive False. This behaviour might be improved in master later. --- addons/resource/models/resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index ddb3238320a..ddf68e079bf 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -34,7 +34,7 @@ def to_naive_utc(datetime, record): def to_tz(datetime, tz_name): - tz = pytz.timezone(tz_name) + tz = pytz.timezone(tz_name) if tz_name else pytz.UTC return pytz.UTC.localize(datetime.replace(tzinfo=None), is_dst=False).astimezone(tz).replace(tzinfo=None)