inventree / inventree-python

Python library for communication with inventree via API
https://docs.inventree.org/en/latest/api/python/python/
MIT License
26 stars 34 forks source link

Filtering to null values #146

Closed martonmiklos closed 1 year ago

martonmiklos commented 1 year ago

I have added the parent_id for the filtering fields in the InvenTree #3876, however I do not know how to filter the categories without parent.

If I do a >>> cats = PartCategory.list(api, parent_id='') It ends up in a request: [28/Oct/2022 22:01:54] "GET /api/part/category/?parent_id= HTTP/1.1" 200 470422 but it sends back all categories.

Is there any trick what I am missing?

SchrodingersGat commented 1 year ago

Use the parent field (not parent_id), and specify "None" or "null"

image

martonmiklos commented 1 year ago

I apologize for being blind. I think I will improve the docs with this.