mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
[PUI] refactor table filter selector (#6047)
* Add FilterSelectDrawer component * Add descriptions for build order table filters * Pass active filters through via UseTable hook * Remove old FilterGroup component * Add callback to remove selected filter * Implement interface for adding new filters * Prevent duplication of filters * Hide "add filter" elements after creating new filter * Improved rendering * Implement more filters for stock item table * Add some filters for stock location table * Refactor filter choice method - Add StatusFilterOptions callback - Update filters for existing tables * purchase order table filters * Implement more table filters * Fix unused imports * Render display value, not raw value * Cleanup * UI improvements
This commit is contained in:
@ -820,8 +820,9 @@ class PartFilter(rest_filters.FilterSet):
|
||||
def filter_has_units(self, queryset, name, value):
|
||||
"""Filter by whether the Part has units or not"""
|
||||
if str2bool(value):
|
||||
return queryset.exclude(units='')
|
||||
return queryset.filter(units='')
|
||||
return queryset.exclude(Q(units=None) | Q(units=''))
|
||||
|
||||
return queryset.filter(Q(units=None) | Q(units='')).distinct()
|
||||
|
||||
# Filter by parts which have (or not) an IPN value
|
||||
has_ipn = rest_filters.BooleanFilter(label='Has IPN', method='filter_has_ipn')
|
||||
|
Reference in New Issue
Block a user