From 10592f472ca96bb1c137d25ccd82cc449c81dbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20L=C3=B3pez?= Date: Thu, 30 Apr 2020 15:13:33 +0000 Subject: [PATCH] [IMP] base_automation: log time-based automated action starts and ends If there is cron worker timeout logger error, there is a log for the last cron running If a "Base Action Rule: check and execute" fails, we need to know what is the last base automated action based on-time running This logger helps to looked for it closes odoo/odoo#50493 Signed-off-by: Martin Trigaux (mat) --- addons/base_automation/models/base_automation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py index 5051ed9f60d..0d1e5604f88 100644 --- a/addons/base_automation/models/base_automation.py +++ b/addons/base_automation/models/base_automation.py @@ -474,6 +474,7 @@ class BaseAutomation(models.Model): # retrieve all the action rules to run based on a timed condition eval_context = self._get_eval_context() for action in self.with_context(active_test=True).search([('trigger', '=', 'on_time')]): + _logger.info("Starting time-based automated action `%s`.", action.name) last_run = fields.Datetime.from_string(action.last_run) or datetime.datetime.utcfromtimestamp(0) # retrieve all the records that satisfy the action's condition @@ -503,6 +504,7 @@ class BaseAutomation(models.Model): _logger.error(traceback.format_exc()) action.write({'last_run': now.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}) + _logger.info("Time-based automated action `%s` done.", action.name) if automatic: # auto-commit for batch processing