mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]14.0-pms_api_rest: domain for transaction type filters
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user