mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-17 04:35:26 +00:00
Create detail view for part stock
- Shows all in-stock stock items
This commit is contained in:
@ -147,10 +147,38 @@ class InvenTreePart extends InvenTreeModel {
|
||||
};
|
||||
}
|
||||
|
||||
// Cached list of stock items
|
||||
List<InvenTreeStockItem> stockItems = List<InvenTreeStockItem>();
|
||||
|
||||
int get stockItemCount => stockItems.length;
|
||||
|
||||
// Request stock items for this part
|
||||
Future<void> getStockItems(BuildContext context, {bool showDialog=false}) async {
|
||||
|
||||
InvenTreeStockItem().list(
|
||||
context,
|
||||
filters: {
|
||||
"part": "${pk}",
|
||||
"in_stock": "true",
|
||||
},
|
||||
dialog: showDialog,
|
||||
).then((var items) {
|
||||
stockItems.clear();
|
||||
|
||||
for (var item in items) {
|
||||
if (item is InvenTreeStockItem) {
|
||||
stockItems.add(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Cached list of test templates
|
||||
List<InvenTreePartTestTemplate> testingTemplates = List<InvenTreePartTestTemplate>();
|
||||
|
||||
int get testTemplateCount => testingTemplates.length;
|
||||
|
||||
// Request test templates from the serve
|
||||
Future<void> getTestTemplates(BuildContext context, {bool showDialog=false}) async {
|
||||
|
||||
InvenTreePartTestTemplate().list(
|
||||
|
@ -283,9 +283,9 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
String get locationName {
|
||||
String loc = '';
|
||||
|
||||
if (jsondata.containsKey('location_detail')) {
|
||||
loc = jsondata['location_detail']['name'] ?? '';
|
||||
}
|
||||
if (locationId == -1 || !jsondata.containsKey('location_detail')) return 'Unknown Location';
|
||||
|
||||
loc = jsondata['location_detail']['name'] ?? '';
|
||||
|
||||
// Old-style name
|
||||
if (loc.isEmpty) {
|
||||
@ -298,11 +298,9 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
String get locationPathString {
|
||||
String path = '';
|
||||
|
||||
if (jsondata.containsKey('location_detail')) {
|
||||
path = jsondata['location_detail']['pathstring'] ?? '';
|
||||
}
|
||||
if (locationId == -1 || !jsondata.containsKey('location_detail')) return 'No location specified';
|
||||
|
||||
return path;
|
||||
return jsondata['location_detail']['pathstring'] ?? '';
|
||||
}
|
||||
|
||||
String get displayQuantity {
|
||||
|
Reference in New Issue
Block a user