Add created_after/created_before date filters to search_helpdesk_tickets
This commit is contained in:
+9
-1
@@ -389,8 +389,12 @@ def list_task_stages(project_id: int = None) -> list:
|
||||
|
||||
@mcp.tool()
|
||||
def search_helpdesk_tickets(query: str = "", stage: str = "", team: str = "",
|
||||
created_after: str = "", created_before: str = "",
|
||||
limit: int = 20) -> list:
|
||||
"""Search helpdesk tickets by name, stage, or team."""
|
||||
"""Search helpdesk tickets by name, stage, or team.
|
||||
created_after and created_before accept datetime strings in 'YYYY-MM-DD' or
|
||||
'YYYY-MM-DD HH:MM:SS' format to filter by creation date.
|
||||
Example: created_after='2026-03-29' returns tickets created in the last 24 hours."""
|
||||
domain = []
|
||||
if query:
|
||||
domain.append(["name", "ilike", query])
|
||||
@@ -398,6 +402,10 @@ def search_helpdesk_tickets(query: str = "", stage: str = "", team: str = "",
|
||||
domain.append(["stage_id.name", "ilike", stage])
|
||||
if team:
|
||||
domain.append(["team_id.name", "ilike", team])
|
||||
if created_after:
|
||||
domain.append(["create_date", ">=", created_after])
|
||||
if created_before:
|
||||
domain.append(["create_date", "<=", created_before])
|
||||
return _search_read("helpdesk.ticket", domain,
|
||||
["id", "name", "partner_id", "stage_id", "team_id",
|
||||
"user_id", "priority", "create_date"],
|
||||
|
||||
Reference in New Issue
Block a user