pyopenproject icon indicating copy to clipboard operation
pyopenproject copied to clipboard

Filter by "are not NULL" operator ("*") does not work for custom field

Open mnesarco opened this issue 1 year ago • 0 comments

Hello, I am trying to filter by custom field, looking only for tasks with a non null value, but it refuses to work:

wps = client.get_work_package_service()
tasks = wps.find_all([Filter('customField1', '*', values=[])])

Results in error:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/test/.cache/pypoetry/virtualenvs/op-diam-Nfha37ZV-py3.12/lib/python3.12/site-packages/pyopenproject/business/services/command/work_package/find_all.py", line 30, in execute
    return FindListCommand(self.connection, request, WorkPackage).execute()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/test/.cache/pypoetry/virtualenvs/op-diam-Nfha37ZV-py3.12/lib/python3.12/site-packages/pyopenproject/business/services/command/find_list_command.py", line 13, in execute
    return self.next_page_objects(obj_list=[], json_obj=self.request.execute())
                                                        ^^^^^^^^^^^^^^^^^^^^^^
  File "/test/.cache/pypoetry/virtualenvs/op-diam-Nfha37ZV-py3.12/lib/python3.12/site-packages/pyopenproject/api_connection/request.py", line 59, in execute
    raise RequestError(f"Error running request with the URL (HTTPError):"
pyopenproject.api_connection.exceptions.request_exception.RequestError: Error running request with the URL (HTTPError): 'http://localhost:8088/api/v3/work_packages/?filters=[{"customField1":{"operator":"*","values":[]}}]'.
 {"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:InvalidQuery","message":"Repetir Operator no está establecido a uno de los valores permitidos."}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/test/devel/projects/ladrilleras/OpenProject_Hooks/op-diam/op_diam/recurring.py", line 10, in <module>
    tasks = wps.find_all([Filter('customField1', '*', values=[])])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/test/.cache/pypoetry/virtualenvs/op-diam-Nfha37ZV-py3.12/lib/python3.12/site-packages/pyopenproject/business/services/work_package_service_impl.py", line 65, in find_all
    return list(FindAll(self.connection, filters, sort_by, group_by, show_sums).execute())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/test/.cache/pypoetry/virtualenvs/op-diam-Nfha37ZV-py3.12/lib/python3.12/site-packages/pyopenproject/business/services/command/work_package/find_all.py", line 35, in execute
    raise BusinessError("Error finding all work packages") from re
pyopenproject.business.exception.business_error.BusinessError: Error finding all work packages

mnesarco avatar May 16 '24 18:05 mnesarco