[IMP]14.0-pms_api_rest: domain for transaction type filters

This commit is contained in:
braisab
2023-10-24 14:45:49 +02:00
committed by Darío Lodeiros
parent 381fa0f555
commit 8d83ffeb22

View File

@@ -81,19 +81,23 @@ class PmsTransactionService(Component):
) )
if pms_transactions_search_param.transactionType: if pms_transactions_search_param.transactionType:
domain_fields.append( transaction_types = pms_transactions_search_param.transactionType.split(",")
( type_domain = []
"pms_api_transaction_type",
"=",
pms_transactions_search_param.transactionType,
)
)
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: if domain_filter:
domain = expression.AND([domain_fields, domain_filter[0]]) domain = expression.AND([domain_fields, domain_filter[0]])
else: else:
domain = domain_fields domain = domain_fields
PmsTransactionResults = self.env.datamodels["pms.transaction.results"] PmsTransactionResults = self.env.datamodels["pms.transaction.results"]
PmsTransactiontInfo = self.env.datamodels["pms.transaction.info"] PmsTransactiontInfo = self.env.datamodels["pms.transaction.info"]
total_transactions = self.env["account.payment"].search_count(domain) total_transactions = self.env["account.payment"].search_count(domain)