From fecffb3124414ecc66ece9ea43b6371d7fd3dbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 23 Jan 2023 00:43:49 +0100 Subject: [PATCH] Update purchase request state after the purchase transition Closes #6362 --- modules/purchase_request/purchase.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/purchase_request/purchase.py b/modules/purchase_request/purchase.py index 9ec918c4d7..4eee8b8e27 100644 --- a/modules/purchase_request/purchase.py +++ b/modules/purchase_request/purchase.py @@ -13,6 +13,8 @@ from .exceptions import PurchaseWarehouseWarning def process_request(func): + # Must be run after the purchase transition + # such as purchase has the proper state @wraps(func) def wrapper(cls, purchases): pool = Pool() @@ -70,14 +72,14 @@ class Purchase(metaclass=PoolMeta): @classmethod @ModelView.button - @Workflow.transition('cancelled') @process_request + @Workflow.transition('cancelled') def cancel(cls, purchases): super(Purchase, cls).cancel(purchases) @classmethod - @Workflow.transition('done') @process_request + @Workflow.transition('done') def do(cls, purchases): super(Purchase, cls).do(purchases)