[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 bccc0ae0e8
pull/819/head
Víctor Martínez 2025-03-31 08:52:55 +02:00
parent 31915863ab
commit 92580c31aa
2 changed files with 12 additions and 1 deletions

View File

@ -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):

View File

@ -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"
):