From 84dec6b227e70375e06ff22f9a50bb82153f9f8a Mon Sep 17 00:00:00 2001 From: Maxence Groine Date: Wed, 29 Oct 2025 12:22:57 +0100 Subject: [PATCH] [FIX] account_payment_order: filter out non-draft moves when cancelling payments Calling `action_draft()` on `draft` moves raises a UserError which blocks the "Cancel Payments" button from working properly. --- account_payment_order/models/account_payment_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py index 35772e95162..cf8b65a8f58 100644 --- a/account_payment_order/models/account_payment_order.py +++ b/account_payment_order/models/account_payment_order.py @@ -252,7 +252,7 @@ def cancel2draft(self): def action_cancel(self): # Unreconcile and cancel payments - self.payment_ids.action_draft() + self.payment_ids.filtered(lambda p: p.move_id.state != "draft").action_draft() self.payment_ids.action_cancel() self.write({"state": "cancel"}) return True