From d51c6b09443527bc57437f197dbe1bcceb4f0248 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Thu, 18 Jun 2015 17:14:18 +0500 Subject: [PATCH] [FIX] tz of admin was used instead of current user --- models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models.py b/models.py index d2e5ef2..46d5d14 100644 --- a/models.py +++ b/models.py @@ -30,7 +30,7 @@ class FetchMailServer(models.Model): src_tstamp_str = self._last_updated.strftime(tools.misc.DEFAULT_SERVER_DATETIME_FORMAT) src_format = tools.misc.DEFAULT_SERVER_DATETIME_FORMAT dst_format = tools.misc.DEFAULT_SERVER_DATETIME_FORMAT - dst_tz_name = self.env.user.tz + dst_tz_name = self._context.get('tz') or self.env.user.tz _now = tools.misc.server_to_local_timestamp(src_tstamp_str, src_format, dst_format, dst_tz_name) self.run_time = _now @@ -53,7 +53,7 @@ class FetchMailImmediately(models.AbstractModel): @api.model def get_last_update_time(self): - res = self.env['fetchmail.server'].sudo().search([('state', '=', 'done')]) + res = self.env['fetchmail.server'].sudo().with_context(tz=self.env.user.tz).search([('state', '=', 'done')]) array = [r.run_time for r in res] if array: return array[0]