From 21985584c2155908e959309b6b460b0023cd0bf4 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 2 Aug 2021 13:45:57 +1000 Subject: [PATCH] Add accessor functions for SupplierPart and ManufacturerPart models --- lib/inventree/company.dart | 14 ++++++++++++++ lib/l10n | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/inventree/company.dart b/lib/inventree/company.dart index 48fc6d29..caf8ea05 100644 --- a/lib/inventree/company.dart +++ b/lib/inventree/company.dart @@ -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 json) { var part = InvenTreeSupplierPart.fromJson(json); @@ -71,6 +79,12 @@ class InvenTreeManufacturerPart extends InvenTreeModel { InvenTreeManufacturerPart.fromJson(Map 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 json) { var part = InvenTreeManufacturerPart.fromJson(json); diff --git a/lib/l10n b/lib/l10n index b49ea658..f53df596 160000 --- a/lib/l10n +++ b/lib/l10n @@ -1 +1 @@ -Subproject commit b49ea65800fd9e6bd96f59ae89e41829f4dd640a +Subproject commit f53df5968c451c511152d931ef32290644e21747