mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Bug fix for part without a category defined
This commit is contained in:
parent
153bb1c077
commit
72512329e9
2 changed files with 25 additions and 5 deletions
|
|
@ -132,6 +132,14 @@ class InvenTreePart extends InvenTreeModel {
|
|||
@override
|
||||
String URL = "part/";
|
||||
|
||||
@override
|
||||
Map<String, String> defaultListFilters() {
|
||||
return {
|
||||
"cascade": "false",
|
||||
"active": "true",
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> defaultGetFilters() {
|
||||
return {
|
||||
|
|
@ -202,11 +210,20 @@ class InvenTreePart extends InvenTreeModel {
|
|||
int get categoryId => jsondata['category'] as int ?? null;
|
||||
|
||||
// Get the category name for the Part instance
|
||||
String get categoryName => jsondata['category_detail']['name'] as String ?? '';
|
||||
String get categoryName {
|
||||
if (categoryId == null) return '';
|
||||
if (!jsondata.containsKey('category_detail')) return '';
|
||||
|
||||
return jsondata['category_detail']['name'] as String ?? '';
|
||||
}
|
||||
|
||||
// Get the category description for the Part instance
|
||||
String get categoryDescription => jsondata['category_detail']['description'] as String ?? '';
|
||||
String get categoryDescription {
|
||||
if (categoryId == null) return '';
|
||||
if (!jsondata.containsKey('category_detail')) return '';
|
||||
|
||||
return jsondata['category_detail']['description'] as String ?? '';
|
||||
}
|
||||
// Get the image URL for the Part instance
|
||||
String get _image => jsondata['image'] ?? '';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue