2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

Get list of required tets

This commit is contained in:
Oliver Walters
2020-05-23 14:37:27 +10:00
parent 687b5ed8c7
commit 70ca369529
2 changed files with 29 additions and 1 deletions

View File

@ -71,6 +71,33 @@ class InvenTreePart extends InvenTreeModel {
@override
String URL = "part/";
List<dynamic> testTemplates;
int get testTemplateCount {
if (testTemplates == null) {
return 0;
} else {
return testTemplates.length;
}
}
Future<void> getTestTemplates() async {
var response = await api.get("/part/test-template/", params: {
"part": "${pk}",
})
.timeout(Duration(seconds: 10))
.catchError((e) {
return;
});
print("Status: " + response.statusCode.toString());
testTemplates = json.decode(response.body);
return;
}
// Get the number of stock on order for this Part
double get onOrder => double.tryParse(jsondata['ordering'].toString() ?? '0');