Create detail view for part stock

- Shows all in-stock stock items
This commit is contained in:
Oliver Walters 2021-01-20 23:56:25 +11:00
parent 15fee106b5
commit 83465511aa
5 changed files with 168 additions and 10 deletions

View file

@ -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(