From ffaa3f096c9a0bbb8137c6bcde11dd5265bb97d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 6 Feb 2024 13:26:34 +0100 Subject: [PATCH] Clear transaction tasks on retry of with_transaction decorator Closes #13008 --- trytond/trytond/protocols/wrappers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/trytond/protocols/wrappers.py b/trytond/trytond/protocols/wrappers.py index 5575654176..d3299fd680 100644 --- a/trytond/trytond/protocols/wrappers.py +++ b/trytond/trytond/protocols/wrappers.py @@ -247,11 +247,13 @@ def with_transaction(readonly=None, user=0, context=None): result = func(request, pool, *args, **kwargs) except TransactionError as e: transaction.rollback() + transaction.tasks.clear() e.fix(transaction_extras) continue except backend.DatabaseOperationalError: if count < retry and not readonly_: transaction.rollback() + transaction.tasks.clear() count += 1 continue raise