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

Supplier part support (#253)

* Bump version and release noes

* Add barebone list and detail widgets for the SupplierPart model

* Launch into SupplierPartList from CompanyDetail

* Update StockDetail widget

* Fixes for SupplierPart model

* Add images to supplier part list

* Add search functionality to SupplierPart list

* Added details to SupplierPartDetail widget

* Link through to supplier company

* Add some more details

* Adds ability to edit SupplierPart information

* Navigate to supplier part list from part detail page

* Display supplier part information on stock item detail page

* Add barcode scan response for SupplierPart

* Refactor barcode scanning code

* Navigate to supplier part detail from stock item page

* Support custom barcode for SupplierPart via app

* Cleanup comment

* linting

* Fix override

* Enable display of supplier list on home screen

* Code cleanup

* Update release noets
This commit is contained in:
Oliver
2023-02-04 09:05:36 +11:00
committed by GitHub
parent ce37d0e757
commit 15bf109296
22 changed files with 798 additions and 295 deletions

View File

@ -98,11 +98,23 @@ class InvenTreeSupplierPart extends InvenTreeModel {
@override
String get URL => "company/part/";
@override
Map<String, dynamic> formFields() {
return {
"supplier": {},
"SKU": {},
"link": {},
"note": {},
"packaging": {},
"pack_size": {},
};
}
Map<String, String> _filters() {
return {
"manufacturer_detail": "true",
"supplier_detail": "true",
"manufacturer_part_detail": "true",
"part_detail": "true",
};
}
@ -116,29 +128,31 @@ class InvenTreeSupplierPart extends InvenTreeModel {
return _filters();
}
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
String get manufacturerName => (jsondata["manufacturer_detail"]?["name"] ?? "") as String;
String get manufacturerName => (jsondata["manufacturer_detail"]["name"] ?? "") as String;
String get MPN => (jsondata["manufacturer_part_detail"]?["MPN"] ?? "") as String;
String get manufacturerImage => (jsondata["manufacturer_detail"]["image"] ?? jsondata["manufacturer_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
String get manufacturerImage => (jsondata["manufacturer_detail"]?["image"] ?? jsondata["manufacturer_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
int get manufacturerPartId => (jsondata["manufacturer_part"] ?? -1) as int;
int get supplierId => (jsondata["supplier"] ?? -1) as int;
String get supplierName => (jsondata["supplier_detail"]["name"] ?? "") as String;
String get supplierName => (jsondata["supplier_detail"]?["name"] ?? "") as String;
String get supplierImage => (jsondata["supplier_detail"]["image"] ?? jsondata["supplier_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
String get supplierImage => (jsondata["supplier_detail"]?["image"] ?? jsondata["supplier_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
String get SKU => (jsondata["SKU"] ?? "") as String;
String get MPN => (jsondata["MPN"] ?? "") as String;
int get partId => (jsondata["part"] ?? -1) as int;
String get partImage => (jsondata["part_detail"]["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
String get partImage => (jsondata["part_detail"]?["thumbnail"] ?? InvenTreeAPI.staticThumb) as String;
String get partName => (jsondata["part_detail"]["full_name"] ?? "") as String;
String get partName => (jsondata["part_detail"]?["full_name"] ?? "") as String;
String get partDescription => (jsondata["part_detail"]?["description"] ?? "") as String;
String get note => (jsondata["note"] ?? "") as String;
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) {

View File

@ -416,8 +416,10 @@ class InvenTreeStockItem extends InvenTreeModel {
String get supplierImage {
String thumb = "";
if (jsondata.containsKey("supplier_detail")) {
thumb = (jsondata["supplier_detail"]["supplier_logo"] ?? "") as String;
if (jsondata.containsKey("supplier_part_detail")) {
thumb = (jsondata["supplier_part_detail"]?["supplier_detail"]?["image"] ?? "") as String;
} else if (jsondata.containsKey("supplier_detail")) {
thumb = (jsondata["supplier_detail"]["image"] ?? "") as String;
}
return thumb;
@ -440,8 +442,8 @@ class InvenTreeStockItem extends InvenTreeModel {
String get supplierSKU {
String sku = "";
if (jsondata.containsKey("supplier_detail")) {
sku = (jsondata["supplier_detail"]["SKU"] ?? "") as String;
if (jsondata.containsKey("supplier_part_detail")) {
sku = (jsondata["supplier_part_detail"]["SKU"] ?? "") as String;
}
return sku;