From 92580c31aa7d042b6174228727fe634d5f1d7a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 31 Mar 2025 08:52:55 +0200 Subject: [PATCH] [FIX] account_reconcile_model_oca: Fix reco model matching on exact_token When the payment label is a single word, we try to match the full value and not only the alphanumeric values. However, the matching was made on the token that was already sanitized using the [0-9a-zA-Z\s] regex. Instead, let's match the full value. Related to https://github.com/odoo/odoo/commit/bccc0ae0e896d58b54debae9483b8744d2b59ddc --- .../models/account_reconcile_model.py | 2 +- .../tests/test_reconciliation_match.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/account_reconcile_model_oca/models/account_reconcile_model.py b/account_reconcile_model_oca/models/account_reconcile_model.py index d03ee752..c269b360 100644 --- a/account_reconcile_model_oca/models/account_reconcile_model.py +++ b/account_reconcile_model_oca/models/account_reconcile_model.py @@ -369,7 +369,7 @@ class AccountReconcileModel(models.Model): # Exact tokens. if len(tokens) == 1: - exact_tokens.append(tokens[0]) + exact_tokens.append(text_value) return numerical_tokens, exact_tokens, text_tokens def _get_invoice_matching_amls_candidates(self, st_line, partner): diff --git a/account_reconcile_model_oca/tests/test_reconciliation_match.py b/account_reconcile_model_oca/tests/test_reconciliation_match.py index 529ac91e..f98bc505 100644 --- a/account_reconcile_model_oca/tests/test_reconciliation_match.py +++ b/account_reconcile_model_oca/tests/test_reconciliation_match.py @@ -1433,6 +1433,17 @@ class TestReconciliationMatchingRules(AccountTestInvoicingCommon): {}, ) + with rollback(): + # Test Matching on exact_token. + term_line.name = "PAY-123" + st_line.payment_ref = "PAY-123" + + # Matching if no checkbox checked. + self.assertDictEqual( + rule._apply_rules(st_line, None), + {"amls": term_line, "model": rule}, + ) + with self.subTest( rule_field="match_text_location_label", st_line_field="payment_ref" ):