Browse Source

[FIX] tz of admin was used instead of current user

pull/1/head
Ivan Yelizariev 10 years ago
parent
commit
d51c6b0944
  1. 4
      models.py

4
models.py

@ -30,7 +30,7 @@ class FetchMailServer(models.Model):
src_tstamp_str = self._last_updated.strftime(tools.misc.DEFAULT_SERVER_DATETIME_FORMAT) src_tstamp_str = self._last_updated.strftime(tools.misc.DEFAULT_SERVER_DATETIME_FORMAT)
src_format = tools.misc.DEFAULT_SERVER_DATETIME_FORMAT src_format = tools.misc.DEFAULT_SERVER_DATETIME_FORMAT
dst_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) _now = tools.misc.server_to_local_timestamp(src_tstamp_str, src_format, dst_format, dst_tz_name)
self.run_time = _now self.run_time = _now
@ -53,7 +53,7 @@ class FetchMailImmediately(models.AbstractModel):
@api.model @api.model
def get_last_update_time(self): 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] array = [r.run_time for r in res]
if array: if array:
return array[0] return array[0]

Loading…
Cancel
Save