mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-10 02:47:49 +00:00
[UI] Add "on_order" column to SupplierPartTable (#13128)
* [UI] Add "on_order" column to SupplierPartTable * Add 'on_order' filter for SupplierPart * Update table * Fix PR ref
This commit is contained in:
1 parent
f9a73273f6
commit
c5253560e8
3 files changed
+28
-2
No files matched your search
@@ -1,11 +1,14 @@
|
||||
"""InvenTree API version information."""
|
||||
|
||||
# InvenTree API version
|
||||
INVENTREE_API_VERSION = 566
|
||||
INVENTREE_API_VERSION = 567
|
||||
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
|
||||
|
||||
INVENTREE_API_TEXT = """
|
||||
|
||||
v567 -> 2026-10-28 : https://github.com/inventree/InvenTree/pull/13128
|
||||
- Allow ordering of SupplierPart API by "on_order" field
|
||||
|
||||
v566 -> 2026-10-25 : https://github.com/inventree/InvenTree/pull/13101
|
||||
- Audit log API (/api/audit/) is available to all authenticated users (entries are filtered by model permissions)
|
||||
- Adds "event_type", "event_label", "notes" and "deltas" fields to the audit log API
|
||||
|
||||
@@ -327,6 +327,15 @@ class SupplierPartFilter(FilterSet):
|
||||
else:
|
||||
return queryset.exclude(in_stock__gt=0)
|
||||
|
||||
on_order = rest_filters.BooleanFilter(label=_('On Order'), method='filter_on_order')
|
||||
|
||||
def filter_on_order(self, queryset, name, value):
|
||||
"""Filter the queryset based on whether the SupplierPart has stock on order."""
|
||||
if value:
|
||||
return queryset.filter(on_order__gt=0)
|
||||
else:
|
||||
return queryset.exclude(on_order__gt=0)
|
||||
|
||||
tag_name = common.filters.TagsFilter()
|
||||
|
||||
|
||||
@@ -407,6 +416,7 @@ class SupplierPartList(
|
||||
'packaging',
|
||||
'pack_quantity',
|
||||
'in_stock',
|
||||
'on_order',
|
||||
'updated',
|
||||
]
|
||||
|
||||
|
||||
@@ -143,7 +143,15 @@ export function SupplierPartTable({
|
||||
}),
|
||||
DecimalColumn({
|
||||
accessor: 'in_stock',
|
||||
sortable: true
|
||||
sortable: true,
|
||||
filter: ['has_stock']
|
||||
}),
|
||||
DecimalColumn({
|
||||
accessor: 'on_order',
|
||||
title: t`On Order`,
|
||||
sortable: true,
|
||||
defaultVisible: false,
|
||||
filter: ['on_order']
|
||||
}),
|
||||
{
|
||||
accessor: 'packaging',
|
||||
@@ -273,6 +281,11 @@ export function SupplierPartTable({
|
||||
name: 'has_stock',
|
||||
label: t`In Stock`,
|
||||
description: t`Show supplier parts with stock`
|
||||
},
|
||||
{
|
||||
name: 'on_order',
|
||||
label: t`On Order`,
|
||||
description: t`Show supplier parts on order`
|
||||
}
|
||||
];
|
||||
}, []);
|
||||
|
||||
Reference in new issue
Block a user