From 2688aad6821b9b591fbb87a7a2aadd855ffd4010 Mon Sep 17 00:00:00 2001 From: jce Date: Thu, 18 Feb 2016 16:12:35 +0500 Subject: [PATCH 1/3] Fix updated time bug. --- models.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/models.py b/models.py index 46d5d14..3306837 100644 --- a/models.py +++ b/models.py @@ -14,17 +14,10 @@ class FetchMailServer(models.Model): _last_updated = None - run_time = fields.Datetime(string="Launch time", compute='_run_time', store=False) + run_time = fields.Datetime(string="Launch time") - @classmethod - def _update_time(cls): - - cls._last_updated = tools.datetime.now() - - @api.one def _run_time(self): if not self._last_updated: - self._last_updated = tools.datetime.now() src_tstamp_str = self._last_updated.strftime(tools.misc.DEFAULT_SERVER_DATETIME_FORMAT) @@ -33,7 +26,7 @@ class FetchMailServer(models.Model): 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 + return _now @api.model def _fetch_mails(self): @@ -44,7 +37,10 @@ class FetchMailServer(models.Model): raise exceptions.Warning(_('Error'), _('Task can be started no earlier than 5 seconds.')) super(FetchMailServer, self)._fetch_mails() - self._update_time() + + res = self.env['fetchmail.server'].sudo().with_context(tz=self.env.user.tz).search([('state', '=', 'done')]) + if res: + res[0].run_time = self._run_time() class FetchMailImmediately(models.AbstractModel): From ea188bd1dafb7ef143c47753e30746d26a03656d Mon Sep 17 00:00:00 2001 From: jce Date: Fri, 19 Feb 2016 10:37:21 +0500 Subject: [PATCH 2/3] Added doc/changelog.rst and updated version into __openerp__.py --- __openerp__.py | 2 +- doc/changelog.rst | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 doc/changelog.rst diff --git a/__openerp__.py b/__openerp__.py index abe68ad..4ed2708 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -1,6 +1,6 @@ { 'name' : 'Check mail immediately', - 'version' : '1.0.0', + 'version' : '1.0.1', 'author' : 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', 'category' : 'Social Network', diff --git a/doc/changelog.rst b/doc/changelog.rst new file mode 100644 index 0000000..d6e46bf --- /dev/null +++ b/doc/changelog.rst @@ -0,0 +1,9 @@ +.. _changelog: + +Changelog +========= + +`1.0.1` +------- + +- FIX: updated time bug \ No newline at end of file From 6fe443311de507356774815c92328ad332c9bee2 Mon Sep 17 00:00:00 2001 From: x620 Date: Fri, 19 Feb 2016 11:57:01 +0500 Subject: [PATCH 3/3] update comment into changelog.rst --- doc/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index d6e46bf..e72d492 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -6,4 +6,4 @@ Changelog `1.0.1` ------- -- FIX: updated time bug \ No newline at end of file +- FIX: incorrectly displayed last updated time when multiple threads (--workers) \ No newline at end of file