From 70d61dafa1ac388dd0dd45c470b40e039a4890cb Mon Sep 17 00:00:00 2001 From: fw-bot Date: Tue, 5 Nov 2019 17:28:54 +0000 Subject: [PATCH] [FIX] account: payment reference exact match without spaces Cherry pick of 6317e47409f066312f1f5517b0be9ed386235397 failed The spaces should not be important in a structured reference. Also, we should not have to include the second batch as that batch (previously the first) was intended to match the payment reference. By including it, we may have too much false positives proposed in the widget and even worse: auto reconciled. closes odoo/odoo#39820 Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/account_reconcile_model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index 7dc1744f9aa..83a65f028f0 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -501,7 +501,7 @@ class AccountReconcileModel(models.Model): ( move.invoice_payment_ref IS NOT NULL AND - TRIM(move.invoice_payment_ref) = TRIM(st_line.name) + regexp_replace(move.invoice_payment_ref, '\s+', '', 'g') = regexp_replace(st_line.name, '\s+', '', 'g') ) AS payment_reference_flag FROM account_bank_statement_line st_line LEFT JOIN account_journal journal ON journal.id = st_line.journal_id @@ -566,7 +566,7 @@ class AccountReconcileModel(models.Model): ( move.invoice_payment_ref IS NOT NULL AND - TRIM(move.invoice_payment_ref) = TRIM(st_line.name) + regexp_replace(move.invoice_payment_ref, '\s+', '', 'g') = regexp_replace(st_line.name, '\s+', '', 'g') ) ) ) @@ -794,7 +794,7 @@ class AccountReconcileModel(models.Model): break # Needed to handle check on total residual amounts. - if first_batch_candidates or first_batch_candidates_proposed or second_batch_candidates or second_batch_candidates_proposed or model._check_rule_propositions(line, available_candidates): + if first_batch_candidates or first_batch_candidates_proposed or model._check_rule_propositions(line, available_candidates): results[line.id]['model'] = model # Add candidates to the result.