2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-15 03:35:28 +00:00

Add accessor functions for SupplierPart and ManufacturerPart models

This commit is contained in:
Oliver
2021-08-02 13:45:57 +10:00
parent 76e0dd6803
commit 21985584c2
2 changed files with 15 additions and 1 deletions

View File

@ -52,6 +52,14 @@ class InvenTreeSupplierPart extends InvenTreeModel {
// TODO
}
int get manufacturerId => (jsondata['manufacturer'] ?? -1) as int;
int get manufacturerPartId => (jsondata['manufacturer_part'] ?? -1) as int;
int get supplierId => (jsondata['supplier'] ?? -1) as int;
String get SKU => (jsondata['SKU'] ?? '') as String;
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) {
var part = InvenTreeSupplierPart.fromJson(json);
@ -71,6 +79,12 @@ class InvenTreeManufacturerPart extends InvenTreeModel {
InvenTreeManufacturerPart.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
}
int get partId => (jsondata['part'] ?? -1) as int;
int get manufacturerId => (jsondata['manufacturer'] ?? -1) as int;
String get MPN => (jsondata['MPN'] ?? '') as String;
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) {
var part = InvenTreeManufacturerPart.fromJson(json);