From 8bae36bc1a5d3bf39d00753b56109bef448b42b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Thu, 20 May 2021 07:29:52 +0000 Subject: [PATCH] [FIX] event: fix savepoint issue with event mail scheduler This commit removes a savepoint call when running the event mail scheduler. Indeed, this save point registration was colliding with the fact that we commit the assets bundle during the reporting process, see 'commit_assetsbundle' context key. Since the transaction was commit during the report generation, when reaching the end of the savepoint block, the system was trying to release a savepoint that was no longer existing. Indeed, committing removes all savepoints, since (quoting the Postgres doc) "Savepoints can only be established when inside a transaction block.", which makes total sense. This was leading to a: bad query: RELEASE SAVEPOINT "669516d2915811eba8d2b4d5bde7cdcc" Aborting the whole event mail scheduler process. As it's rather unclear why this savepoint was introduced in the first place, we attempt to remove it. This change is done in a singular commit to be easily revertable if ever necessary. Task-26779 --- addons/event/models/event_mail.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/event/models/event_mail.py b/addons/event/models/event_mail.py index 9bdfa4cd7a8..ed1f396221f 100644 --- a/addons/event/models/event_mail.py +++ b/addons/event/models/event_mail.py @@ -235,9 +235,8 @@ You receive this email because you are: for scheduler in schedulers: try: - with self.env.cr.savepoint(): - # Prevent a mega prefetch of the registration ids of all the events of all the schedulers - self.browse(scheduler.id).execute() + # Prevent a mega prefetch of the registration ids of all the events of all the schedulers + self.browse(scheduler.id).execute() except Exception as e: _logger.exception(e) self.invalidate_cache()