From 94dc2fe5f7c79fd84a68c2048812accf0b3da0eb Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Fri, 14 Jun 2019 07:28:41 +0000 Subject: [PATCH] [FIX] account: Fix matching rules with empty communication The way to find a matching about structured communication is done by: 1 - making a filter to keep only numerical values. 2 - splitting the result into array. 3 - finding an intersect between the sets. For example, "Payment about +++123/456789+++ and +++987/654321+++" is matching "123456789 blablabla"? 1 - "123456789 987654321" is matching "123456789" ? 2 - ["123456789", "987654321"] is matching ["123456789"] 3 - YES because "123456789" intersects both sets. This commit is about the check is always TRUE when both sets are empty. In this specific case, the result must be FALSE. -opw: 2008299 closes odoo/odoo#34115 Signed-off-by: Nicolas Martinelli (nim) --- addons/account/models/account_reconcile_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index df4295912d2..deff0119087 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -442,6 +442,8 @@ class AccountReconcileModel(models.Model): ( line_partner.partner_id = 0 AND + TRIM(REGEXP_REPLACE(st_line.name, '[^0-9|^\s]', '', 'g')) != '' + AND ( regexp_split_to_array(TRIM(REGEXP_REPLACE(move.name, '[^0-9|^\s]', '', 'g')),'\s+') && regexp_split_to_array(TRIM(REGEXP_REPLACE(st_line.name, '[^0-9|^\s]', '', 'g')), '\s+')