From 8d83ffeb2204f3c66bac6cb984bbd9f76f5cb24f Mon Sep 17 00:00:00 2001 From: braisab Date: Tue, 24 Oct 2023 14:45:49 +0200 Subject: [PATCH] [IMP]14.0-pms_api_rest: domain for transaction type filters --- .../services/pms_transaction_service.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pms_api_rest/services/pms_transaction_service.py b/pms_api_rest/services/pms_transaction_service.py index f88db5ab8..4c11c1332 100644 --- a/pms_api_rest/services/pms_transaction_service.py +++ b/pms_api_rest/services/pms_transaction_service.py @@ -81,19 +81,23 @@ class PmsTransactionService(Component): ) if pms_transactions_search_param.transactionType: - domain_fields.append( - ( - "pms_api_transaction_type", - "=", - pms_transactions_search_param.transactionType, - ) - ) + transaction_types = pms_transactions_search_param.transactionType.split(",") + type_domain = [] + for transaction_type in transaction_types: + payment_type, partner_type = self._get_mapper_transaction_type(transaction_type) + type_domain.append([ + ["partner_type", "=", partner_type], + ["payment_type", "=", payment_type], + ]) + + if type_domain: + type_domain = expression.OR(type_domain) + domain_fields.extend(type_domain) if domain_filter: domain = expression.AND([domain_fields, domain_filter[0]]) else: domain = domain_fields - PmsTransactionResults = self.env.datamodels["pms.transaction.results"] PmsTransactiontInfo = self.env.datamodels["pms.transaction.info"] total_transactions = self.env["account.payment"].search_count(domain)