2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Fixes for type casting

This commit is contained in:
Oliver
2021-09-28 17:53:14 +10:00
parent 9d95cae612
commit c1152ee286
18 changed files with 294 additions and 228 deletions

View File

@ -224,8 +224,10 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
data: {
"parent": (pk > 0) ? pk : null,
},
onSuccess: (data) async {
onSuccess: (result) async {
Map<String, dynamic> data = result as Map<String, dynamic>;
if (data.containsKey("pk")) {
var cat = InvenTreePartCategory.fromJson(data);
@ -252,7 +254,9 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
data: {
"category": (pk > 0) ? pk : null
},
onSuccess: (data) async {
onSuccess: (result) async {
Map<String, dynamic> data = result as Map<String, dynamic>;
if (data.containsKey("pk")) {
var part = InvenTreePart.fromJson(data);
@ -440,7 +444,8 @@ class _PaginatedPartListState extends State<PaginatedPartList> {
params["search"] = _searchTerm;
final bool cascade = await InvenTreeSettingsManager().getValue("partSubcategory", true);
final bool cascade = await InvenTreeSettingsManager().getBool("partSubcategory", true);
params["cascade"] = "${cascade}";
final page = await InvenTreePart().listPaginated(_pageSize, pageKey, filters: params);

View File

@ -146,7 +146,10 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
data: {
"parent": (pk > 0) ? pk : null,
},
onSuccess: (data) async {
onSuccess: (result) async {
Map<String, dynamic> data = result as Map<String, dynamic>;
if (data.containsKey("pk")) {
var loc = InvenTreeStockLocation.fromJson(data);
@ -175,7 +178,10 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
data: {
"location": pk,
},
onSuccess: (data) async {
onSuccess: (result) async {
Map<String, dynamic> data = result as Map<String, dynamic>;
if (data.containsKey("pk")) {
var item = InvenTreeStockItem.fromJson(data);
@ -515,7 +521,8 @@ class _PaginatedStockListState extends State<PaginatedStockList> {
params["search"] = "${_searchTerm}";
// Do we include stock items from sub-locations?
final bool cascade = await InvenTreeSettingsManager().getValue("stockSublocation", true);
final bool cascade = await InvenTreeSettingsManager().getBool("stockSublocation", true);
params["cascade"] = "${cascade}";
final page = await InvenTreeStockItem().listPaginated(_pageSize, pageKey, filters: params);

View File

@ -405,7 +405,10 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
data: {
"part": "${part.pk}",
},
onSuccess: (data) async {
onSuccess: (result) async {
Map<String, dynamic> data = result as Map<String, dynamic>;
if (data.containsKey("pk")) {
var item = InvenTreeStockItem.fromJson(data);

View File

@ -349,13 +349,13 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
hint: L10().searchLocation,
onChanged: null,
itemAsString: (dynamic location) {
return location['pathstring'];
return (location['pathstring'] ?? '') as String;
},
onSaved: (dynamic location) {
if (location == null) {
location_pk = null;
} else {
location_pk = location['pk'];
location_pk = location['pk'] as int;
}
},
isFilteredOnline: true,