From a63866276e215b918c64ea3153e2e0a701892b68 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Tue, 23 Jun 2026 07:32:30 -0500 Subject: [PATCH] [FIX] account_payment_return_import_iso20022: Search payments by ID instead of move_id After this PR https://github.com/OCA/bank-payment/pull/1475, the EndToEndId is generated using the payment ID instead of the journal entry (move) ID. As a result, when importing an payment return XML file, the payment can no longer be matched correctly because the lookup is still performed using the move_id. --- .../models/payment_return.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/account_payment_return_import_iso20022/models/payment_return.py b/account_payment_return_import_iso20022/models/payment_return.py index 2bbed183b05..8506c823f39 100644 --- a/account_payment_return_import_iso20022/models/payment_return.py +++ b/account_payment_return_import_iso20022/models/payment_return.py @@ -16,10 +16,17 @@ def _find_match(self): continue payments = self.env["account.payment"].search( [ - ("move_id", "=", int(line.reference)), + ("id", "=", int(line.reference)), ("payment_order_id", "!=", False), ], ) + if not payments: + payments = self.env["account.payment"].search( + [ + ("move_id", "=", int(line.reference)), + ("payment_order_id", "!=", False), + ], + ) if payments: line.partner_id = payments[0].partner_id for payment in payments: