Skip to content

Add parent to the filterable fields of the StockLocations and PartCat… - #6435

Closed
martonmiklos wants to merge 1 commit into
inventree:masterfrom
martonmiklos:add_parent_filter_to_part_category_and_stock_location
Closed

martonmiklos wants to merge 1 commit into
inventree:masterfrom
martonmiklos:add_parent_filter_to_part_category_and_stock_location

Conversation

@martonmiklos

Copy link
Copy Markdown
Contributor

…egories

@netlify

netlify Bot commented Feb 6, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 5a6540e
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/65c2a6d97fa57f0008fa8f44

@martonmiklos
martonmiklos marked this pull request as draft February 6, 2024 21:59
@SchrodingersGat

Copy link
Copy Markdown
Member

@martonmiklos LGTM. FYI you can already filter by category (for PartCategory API) and location (for StockLocation API). But I think a generic parent filter is a good addition

@martonmiklos

Copy link
Copy Markdown
Contributor Author

@martonmiklos LGTM.

Ahm I put back to WIP because some tests are failing and I want fix them.

FYI you can already filter by category (for PartCategory API) and location (for StockLocation API). But I think a generic parent filter is a good addition

Well I made this change to support some tool development based on the API.
Under the Stock location list I do not see the location filter:
kép

Am I missing something locally?

@SchrodingersGat

Copy link
Copy Markdown
Member

Am I missing something locally?

No. This is a very "old" part of the code which does not get introspected properly by the API generation - something we need to fix!

Actually, upon further inspection I see that the "parent" filter is actually already there - it just is a hidden field...

image

So what we need to do is:

  • Move the "parent" filter into the appropriate FilterSet class (so that it gets exposed to the API docs)
  • Work out how to support the "cascade" option (this is why it currently sits in the current filter_queryset method

Note that any custom filtering in the filter_queryset method does not get exposed to the API docs

@matmair matmair added stock Related to Stock models api Relates to the API labels Feb 6, 2024
@matmair matmair added this to the 0.14.0 milestone Feb 6, 2024
@SchrodingersGat

Copy link
Copy Markdown
Member

@martonmiklos I'm replacing this with #6536 - please refer to the code there :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API stock Related to Stock models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants