mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Cleanup for API error handling
Ref: https://stackoverflow.com/questions/54617432/looking-up-a-deactivated-widgets-ancestor-is-unsafe
This commit is contained in:
parent
90072904a0
commit
33bb6148de
11 changed files with 162 additions and 167 deletions
|
|
@ -161,7 +161,6 @@ class InvenTreePart extends InvenTreeModel {
|
|||
"part": "${pk}",
|
||||
"in_stock": "true",
|
||||
},
|
||||
dialog: showDialog,
|
||||
).then((var items) {
|
||||
stockItems.clear();
|
||||
|
||||
|
|
@ -186,7 +185,6 @@ class InvenTreePart extends InvenTreeModel {
|
|||
filters: {
|
||||
"part": "${pk}",
|
||||
},
|
||||
dialog: showDialog,
|
||||
).then((var templates) {
|
||||
|
||||
testingTemplates.clear();
|
||||
|
|
@ -205,6 +203,15 @@ class InvenTreePart extends InvenTreeModel {
|
|||
// Get the stock count for this Part
|
||||
double get inStock => double.tryParse(jsondata['in_stock'].toString() ?? '0');
|
||||
|
||||
String get inStockString {
|
||||
|
||||
if (inStock == inStock.toInt()) {
|
||||
return inStock.toInt().toString();
|
||||
} else {
|
||||
return inStock.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// Get the number of units being build for this Part
|
||||
double get building => double.tryParse(jsondata['building'].toString() ?? '0');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue