From 79768b48908ad17951329745b6dd7722d5b72b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 Feb 2023 18:09:52 +0100 Subject: [PATCH] Manage RPCReturnException in proteus 35ed4aa50b16 introduced this new exception so proteus execute the returned action when configured with trytond. --- proteus/CHANGELOG | 1 + proteus/proteus/config.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/proteus/CHANGELOG b/proteus/CHANGELOG index 14e6195710..1976629b42 100644 --- a/proteus/CHANGELOG +++ b/proteus/CHANGELOG @@ -1,3 +1,4 @@ +* Manage RPCReturnException * Run action from button Version 6.6.0 - 2022-10-31 diff --git a/proteus/proteus/config.py b/proteus/proteus/config.py index 072c99f5f2..ec20ff7d76 100644 --- a/proteus/proteus/config.py +++ b/proteus/proteus/config.py @@ -181,7 +181,7 @@ class _TrytondMethod(object): self._config = config def __call__(self, *args, **kwargs): - from trytond.rpc import RPC + from trytond.rpc import RPC, RPCReturnException from trytond.tools import is_instance_method from trytond.transaction import Transaction, TransactionError from trytond.worker import run_task @@ -220,6 +220,10 @@ class _TrytondMethod(object): transaction.rollback() e.fix(extras) continue + except RPCReturnException as e: + transaction.rollback() + transaction.tasks.clear() + result = e.result() transaction.commit() break while transaction.tasks: