From 02ccd70dc0dfe2275af8c741b250bb7fc2630350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 31 Mar 2025 08:27:50 +0200 Subject: [PATCH] [FIX] account_reconcile_model_oca: fix partner category reconciliation when partner has multiple categories * Create a reconciliation model that matches partners that have a category `C` * Create a bank statement and a partner that has *multiple* categories, including C. * Validate and reconcile The reconciliation model you created should be used, but it is not. Related to https://github.com/odoo/odoo/commit/a0016fc6c98a0978a3a1f57fe99497c54c333bbc --- .../models/account_reconcile_model.py | 2 +- .../tests/test_reconciliation_match.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/account_reconcile_model_oca/models/account_reconcile_model.py b/account_reconcile_model_oca/models/account_reconcile_model.py index 1fe0f392..17d55815 100644 --- a/account_reconcile_model_oca/models/account_reconcile_model.py +++ b/account_reconcile_model_oca/models/account_reconcile_model.py @@ -258,7 +258,7 @@ class AccountReconcileModel(models.Model): or ( self.match_partner and self.match_partner_category_ids - and partner.category_id not in self.match_partner_category_ids + and not (partner.category_id & self.match_partner_category_ids) ) ): return False diff --git a/account_reconcile_model_oca/tests/test_reconciliation_match.py b/account_reconcile_model_oca/tests/test_reconciliation_match.py index 595175c7..94bebc87 100644 --- a/account_reconcile_model_oca/tests/test_reconciliation_match.py +++ b/account_reconcile_model_oca/tests/test_reconciliation_match.py @@ -773,7 +773,10 @@ class TestReconciliationMatchingRules(AccountTestInvoicingCommon): test_category = self.env["res.partner.category"].create( {"name": "Consulting Services"} ) - self.partner_2.category_id = test_category + test_category2 = self.env["res.partner.category"].create( + {"name": "Consulting Services2"} + ) + self.partner_2.category_id = test_category + test_category2 self.rule_1.match_partner_category_ids |= test_category self._check_statement_matching( self.rule_1,