diff --git a/account_reconcile_model_oca/models/account_reconcile_model.py b/account_reconcile_model_oca/models/account_reconcile_model.py index 766e5923..53eb028e 100644 --- a/account_reconcile_model_oca/models/account_reconcile_model.py +++ b/account_reconcile_model_oca/models/account_reconcile_model.py @@ -445,7 +445,7 @@ class AccountReconcileModel(models.Model): FROM {tables} JOIN account_move account_move_line__move_id ON account_move_line__move_id.id = account_move_line.move_id - WHERE {where_clause} AND {table_alias}.{field} IS NOT NULL + WHERE {where_clause} AND COALESCE({table_alias}.{field}, '') != '' """ ) all_params += where_params diff --git a/account_reconcile_model_oca/tests/test_reconciliation_match.py b/account_reconcile_model_oca/tests/test_reconciliation_match.py index bb46c290..8ee89599 100644 --- a/account_reconcile_model_oca/tests/test_reconciliation_match.py +++ b/account_reconcile_model_oca/tests/test_reconciliation_match.py @@ -1439,6 +1439,19 @@ class TestReconciliationMatchingRules(AccountTestInvoicingCommon): {}, ) + with self.subTest( + rule_field="match_text_location_label", st_line_field="payment_ref" + ): + with rollback(): + term_line.name = "" + st_line.payment_ref = "/?" + + # No exact matching when the term line name is an empty string + self.assertDictEqual( + rule._apply_rules(st_line, None), + {}, + ) + for rule_field, st_line_field in ( ("match_text_location_label", "payment_ref"), ("match_text_location_reference", "ref"),