From ca197d2a714f4460678880affebf614a13cbf634 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Mon, 11 Mar 2024 06:45:27 +0100 Subject: [PATCH] [FIX] base: log cron start/done also when running manually The INFO "Starting job x" and "Job x done" logs are only logged for the automatic executing of the cron by the cron worker. When running the cron manually via its form view, no INFO was logged. The technical support is reporting problems where a cron server action is running twice at a same moment leading to problems such as mass-mailing sending emails twice. There is a mutual exclusion mechanism for cron workers but no exclusion mechanism seems in place for http worker vs cron worker. Logging the "run manually" actions will help us figuring out the problems. X-original-commit: fcc2eabc671557e610688eac93bae333b0a2c119 Part-of: odoo/odoo#157203 --- odoo/addons/base/models/ir_cron.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/addons/base/models/ir_cron.py b/odoo/addons/base/models/ir_cron.py index 0d920b44158..24c9bd67b4d 100644 --- a/odoo/addons/base/models/ir_cron.py +++ b/odoo/addons/base/models/ir_cron.py @@ -93,7 +93,9 @@ class ir_cron(models.Model): def method_direct_trigger(self): self.check_access_rights('write') for cron in self: + _logger.info('Manually starting job `%s`.', cron.name) cron.with_user(cron.user_id).with_context({'lastcall': cron.lastcall}).ir_actions_server_id.run() + _logger.info('Job `%s` done.', cron.name) cron.lastcall = fields.Datetime.now() return True