mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-16 20:25:26 +00:00
More linting work
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import 'package:inventree/api.dart';
|
||||
|
||||
import 'model.dart';
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/inventree/model.dart";
|
||||
|
||||
|
||||
/*
|
||||
@ -9,6 +8,8 @@ import 'model.dart';
|
||||
|
||||
class InvenTreeCompany extends InvenTreeModel {
|
||||
|
||||
InvenTreeCompany() : super();
|
||||
|
||||
@override
|
||||
String get URL => "company/";
|
||||
|
||||
@ -25,23 +26,21 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
};
|
||||
}
|
||||
|
||||
InvenTreeCompany() : super();
|
||||
String get image => (jsondata["image"] ?? jsondata["thumbnail"] ?? InvenTreeAPI.staticImage) as String;
|
||||
|
||||
String get image => (jsondata['image'] ?? jsondata['thumbnail'] ?? InvenTreeAPI.staticImage) as String;
|
||||
String get thumbnail => (jsondata["thumbnail"] ?? jsondata["image"] ?? InvenTreeAPI.staticThumb) as String;
|
||||
|
||||
String get thumbnail => (jsondata['thumbnail'] ?? jsondata['image'] ?? InvenTreeAPI.staticThumb) as String;
|
||||
String get website => (jsondata["website"] ?? "") as String;
|
||||
|
||||
String get website => (jsondata['website'] ?? '') as String;
|
||||
String get phone => (jsondata["phone"] ?? "") as String;
|
||||
|
||||
String get phone => (jsondata['phone'] ?? '') as String;
|
||||
String get email => (jsondata["email"] ?? "") as String;
|
||||
|
||||
String get email => (jsondata['email'] ?? '') as String;
|
||||
bool get isSupplier => (jsondata["is_supplier"] ?? false) as bool;
|
||||
|
||||
bool get isSupplier => (jsondata['is_supplier'] ?? false) as bool;
|
||||
bool get isManufacturer => (jsondata["is_manufacturer"] ?? false) as bool;
|
||||
|
||||
bool get isManufacturer => (jsondata['is_manufacturer'] ?? false) as bool;
|
||||
|
||||
bool get isCustomer => (jsondata['is_customer'] ?? false) as bool;
|
||||
bool get isCustomer => (jsondata["is_customer"] ?? false) as bool;
|
||||
|
||||
InvenTreeCompany.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
@ -83,29 +82,29 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
|
||||
InvenTreeSupplierPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
int get manufacturerId => (jsondata['manufacturer'] ?? -1) as int;
|
||||
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 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 manufacturerPartId => (jsondata["manufacturer_part"] ?? -1) as int;
|
||||
|
||||
int get supplierId => (jsondata['supplier'] ?? -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 SKU => (jsondata["SKU"] ?? "") as String;
|
||||
|
||||
String get MPN => (jsondata['MPN'] ?? '') as String;
|
||||
String get MPN => (jsondata["MPN"] ?? "") as String;
|
||||
|
||||
int get partId => (jsondata['part'] ?? -1) as int;
|
||||
int get partId => (jsondata["part"] ?? -1) as int;
|
||||
|
||||
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;
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
@ -132,11 +131,11 @@ class InvenTreeManufacturerPart extends InvenTreeModel {
|
||||
|
||||
InvenTreeManufacturerPart.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
||||
|
||||
int get partId => (jsondata['part'] ?? -1) as int;
|
||||
int get partId => (jsondata["part"] ?? -1) as int;
|
||||
|
||||
int get manufacturerId => (jsondata['manufacturer'] ?? -1) as int;
|
||||
int get manufacturerId => (jsondata["manufacturer"] ?? -1) as int;
|
||||
|
||||
String get MPN => (jsondata['MPN'] ?? '') as String;
|
||||
String get MPN => (jsondata["MPN"] ?? "") as String;
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
|
@ -1,18 +1,17 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import "dart:async";
|
||||
import "dart:io";
|
||||
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:inventree/api.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:inventree/inventree/sentry.dart';
|
||||
import 'package:inventree/widget/dialogs.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
||||
import "package:inventree/api.dart";
|
||||
import "package:flutter/cupertino.dart";
|
||||
import "package:inventree/inventree/sentry.dart";
|
||||
import "package:inventree/widget/dialogs.dart";
|
||||
import "package:url_launcher/url_launcher.dart";
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:http/http.dart' as http;
|
||||
import "package:path/path.dart" as path;
|
||||
|
||||
import '../l10.dart';
|
||||
import '../api_form.dart';
|
||||
import "package:inventree/l10.dart";
|
||||
import "package:inventree/api_form.dart";
|
||||
|
||||
|
||||
// Paginated response object
|
||||
@ -129,21 +128,21 @@ class InvenTreeModel {
|
||||
|
||||
}
|
||||
|
||||
int get pk => (jsondata['pk'] ?? -1) as int;
|
||||
int get pk => (jsondata["pk"] ?? -1) as int;
|
||||
|
||||
// Some common accessors
|
||||
String get name => (jsondata['name'] ?? '') as String;
|
||||
String get name => (jsondata["name"] ?? "") as String;
|
||||
|
||||
String get description => (jsondata['description'] ?? '') as String;
|
||||
String get description => (jsondata["description"] ?? "") as String;
|
||||
|
||||
String get notes => (jsondata['notes'] ?? '') as String;
|
||||
String get notes => (jsondata["notes"] ?? "") as String;
|
||||
|
||||
int get parentId => (jsondata['parent'] ?? -1) as int;
|
||||
int get parentId => (jsondata["parent"] ?? -1) as int;
|
||||
|
||||
// Legacy API provided external link as "URL", while newer API uses "link"
|
||||
String get link => (jsondata['link'] ?? jsondata['URL'] ?? '') as String;
|
||||
String get link => (jsondata["link"] ?? jsondata["URL"] ?? "") as String;
|
||||
|
||||
void goToInvenTreePage() async {
|
||||
Future <void> goToInvenTreePage() async {
|
||||
|
||||
if (await canLaunch(webUrl)) {
|
||||
await launch(webUrl);
|
||||
@ -152,7 +151,7 @@ class InvenTreeModel {
|
||||
}
|
||||
}
|
||||
|
||||
void openLink() async {
|
||||
Future <void> openLink() async {
|
||||
|
||||
if (link.isNotEmpty) {
|
||||
|
||||
@ -162,7 +161,7 @@ class InvenTreeModel {
|
||||
}
|
||||
}
|
||||
|
||||
String get keywords => (jsondata['keywords'] ?? '') as String;
|
||||
String get keywords => (jsondata["keywords"] ?? "") as String;
|
||||
|
||||
// Create a new object from JSON data (not a constructor!)
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) {
|
||||
@ -198,7 +197,7 @@ class InvenTreeModel {
|
||||
|
||||
var response = await api.get(url, params: defaultGetFilters(), expectedStatusCode: 200);
|
||||
|
||||
if (!response.isValid() || response.data == null || !(response.data is Map)) {
|
||||
if (!response.isValid() || response.data == null || (response.data is! Map)) {
|
||||
|
||||
// Report error
|
||||
if (response.statusCode > 0) {
|
||||
@ -267,12 +266,12 @@ class InvenTreeModel {
|
||||
|
||||
// Override any default values
|
||||
for (String key in filters.keys) {
|
||||
params[key] = filters[key] ?? '';
|
||||
params[key] = filters[key] ?? "";
|
||||
}
|
||||
|
||||
var response = await api.get(url, params: params);
|
||||
|
||||
if (!response.isValid() || response.data == null || !(response.data is Map)) {
|
||||
if (!response.isValid() || response.data == null || response.data is! Map) {
|
||||
|
||||
if (response.statusCode > 0) {
|
||||
await sentryReportMessage(
|
||||
@ -302,18 +301,18 @@ class InvenTreeModel {
|
||||
|
||||
Future<InvenTreeModel?> create(Map<String, dynamic> data) async {
|
||||
|
||||
if (data.containsKey('pk')) {
|
||||
data.remove('pk');
|
||||
if (data.containsKey("pk")) {
|
||||
data.remove("pk");
|
||||
}
|
||||
|
||||
if (data.containsKey('id')) {
|
||||
data.remove('id');
|
||||
if (data.containsKey("id")) {
|
||||
data.remove("id");
|
||||
}
|
||||
|
||||
var response = await api.post(URL, body: data);
|
||||
|
||||
// Invalid response returned from server
|
||||
if (!response.isValid() || response.data == null || !(response.data is Map)) {
|
||||
if (!response.isValid() || response.data == null || response.data is! Map) {
|
||||
|
||||
if (response.statusCode > 0) {
|
||||
await sentryReportMessage(
|
||||
@ -345,7 +344,7 @@ class InvenTreeModel {
|
||||
var params = defaultListFilters();
|
||||
|
||||
for (String key in filters.keys) {
|
||||
params[key] = filters[key] ?? '';
|
||||
params[key] = filters[key] ?? "";
|
||||
}
|
||||
|
||||
params["limit"] = "${limit}";
|
||||
@ -384,7 +383,7 @@ class InvenTreeModel {
|
||||
var params = defaultListFilters();
|
||||
|
||||
for (String key in filters.keys) {
|
||||
params[key] = filters[key] ?? '';
|
||||
params[key] = filters[key] ?? "";
|
||||
}
|
||||
|
||||
var response = await api.get(URL, params: params);
|
||||
@ -403,8 +402,8 @@ class InvenTreeModel {
|
||||
} else if (response.isMap()) {
|
||||
var mData = response.asMap();
|
||||
|
||||
if (mData.containsKey('results')) {
|
||||
data = (response.data['results'] ?? []) as List<dynamic>;
|
||||
if (mData.containsKey("results")) {
|
||||
data = (response.data["results"] ?? []) as List<dynamic>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,9 +422,9 @@ class InvenTreeModel {
|
||||
// Provide a listing of objects at the endpoint
|
||||
// TODO - Static function which returns a list of objects (of this class)
|
||||
|
||||
// TODO - Define a 'delete' function
|
||||
// TODO - Define a "delete" function
|
||||
|
||||
// TODO - Define a 'save' / 'update' function
|
||||
// TODO - Define a "save" / "update" function
|
||||
|
||||
// Override this function for each sub-class
|
||||
bool matchAgainstString(String filter) {
|
||||
@ -462,7 +461,7 @@ class InvenTreeAttachment extends InvenTreeModel {
|
||||
|
||||
InvenTreeAttachment() : super();
|
||||
|
||||
String get attachment => (jsondata["attachment"] ?? '') as String;
|
||||
String get attachment => (jsondata["attachment"] ?? "") as String;
|
||||
|
||||
// Return the filename of the attachment
|
||||
String get filename {
|
||||
@ -500,11 +499,11 @@ class InvenTreeAttachment extends InvenTreeModel {
|
||||
return FontAwesomeIcons.fileAlt;
|
||||
}
|
||||
|
||||
String get comment => (jsondata["comment"] ?? '') as String;
|
||||
String get comment => (jsondata["comment"] ?? "") as String;
|
||||
|
||||
DateTime? get uploadDate {
|
||||
if (jsondata.containsKey("upload_date")) {
|
||||
return DateTime.tryParse((jsondata["upload_date"] ?? '') as String);
|
||||
return DateTime.tryParse((jsondata["upload_date"] ?? "") as String);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -517,8 +516,8 @@ class InvenTreeAttachment extends InvenTreeModel {
|
||||
final APIResponse response = await InvenTreeAPI().uploadFile(
|
||||
URL,
|
||||
attachment,
|
||||
method: 'POST',
|
||||
name: 'attachment',
|
||||
method: "POST",
|
||||
name: "attachment",
|
||||
fields: fields
|
||||
);
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import 'package:inventree/api.dart';
|
||||
import 'package:inventree/inventree/stock.dart';
|
||||
import 'package:inventree/inventree/company.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:inventree/l10.dart';
|
||||
import "dart:io";
|
||||
|
||||
import 'model.dart';
|
||||
import 'dart:io';
|
||||
import 'package:http/http.dart' as http;
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/inventree/stock.dart";
|
||||
import "package:inventree/inventree/company.dart";
|
||||
import "package:flutter/cupertino.dart";
|
||||
import "package:inventree/l10.dart";
|
||||
|
||||
import "model.dart";
|
||||
|
||||
class InvenTreePartCategory extends InvenTreeModel {
|
||||
|
||||
@ -33,7 +33,7 @@ class InvenTreePartCategory extends InvenTreeModel {
|
||||
return filters;
|
||||
}
|
||||
|
||||
String get pathstring => (jsondata['pathstring'] ?? '') as String;
|
||||
String get pathstring => (jsondata["pathstring"] ?? "") as String;
|
||||
|
||||
String get parentpathstring {
|
||||
// TODO - Drive the refactor tractor through this
|
||||
@ -52,7 +52,7 @@ class InvenTreePartCategory extends InvenTreeModel {
|
||||
return p;
|
||||
}
|
||||
|
||||
int get partcount => (jsondata['parts'] ?? 0) as int;
|
||||
int get partcount => (jsondata["parts"] ?? 0) as int;
|
||||
|
||||
InvenTreePartCategory() : super();
|
||||
|
||||
@ -74,17 +74,15 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
|
||||
@override
|
||||
String get URL => "part/test-template/";
|
||||
|
||||
String get key => (jsondata['key'] ?? '') as String;
|
||||
String get key => (jsondata["key"] ?? "") as String;
|
||||
|
||||
String get testName => (jsondata['test_name'] ?? '') as String;
|
||||
String get testName => (jsondata["test_name"] ?? "") as String;
|
||||
|
||||
String get description => (jsondata['description'] ?? '') as String;
|
||||
bool get required => (jsondata["required"] ?? false) as bool;
|
||||
|
||||
bool get required => (jsondata['required'] ?? false) as bool;
|
||||
bool get requiresValue => (jsondata["requires_value"] ?? false) as bool;
|
||||
|
||||
bool get requiresValue => (jsondata['requires_value'] ?? false) as bool;
|
||||
|
||||
bool get requiresAttachment => (jsondata['requires_attachment'] ?? false) as bool;
|
||||
bool get requiresAttachment => (jsondata["requires_attachment"] ?? false) as bool;
|
||||
|
||||
InvenTreePartTestTemplate() : super();
|
||||
|
||||
@ -195,7 +193,7 @@ class InvenTreePart extends InvenTreeModel {
|
||||
});
|
||||
}
|
||||
|
||||
int get supplierCount => (jsondata['suppliers'] ?? 0) as int;
|
||||
int get supplierCount => (jsondata["suppliers"] ?? 0) as int;
|
||||
|
||||
// Request supplier parts for this part
|
||||
Future<List<InvenTreeSupplierPart>> getSupplierParts() async {
|
||||
@ -242,7 +240,7 @@ class InvenTreePart extends InvenTreeModel {
|
||||
}
|
||||
|
||||
// Get the number of stock on order for this Part
|
||||
double get onOrder => double.tryParse(jsondata['ordering'].toString()) ?? 0;
|
||||
double get onOrder => double.tryParse(jsondata["ordering"].toString()) ?? 0;
|
||||
|
||||
String get onOrderString {
|
||||
|
||||
@ -254,7 +252,7 @@ class InvenTreePart extends InvenTreeModel {
|
||||
}
|
||||
|
||||
// Get the stock count for this Part
|
||||
double get inStock => double.tryParse(jsondata['in_stock'].toString()) ?? 0;
|
||||
double get inStock => double.tryParse(jsondata["in_stock"].toString()) ?? 0;
|
||||
|
||||
String get inStockString {
|
||||
|
||||
@ -271,69 +269,69 @@ class InvenTreePart extends InvenTreeModel {
|
||||
return q;
|
||||
}
|
||||
|
||||
String get units => (jsondata["units"] as String) ?? "";
|
||||
String get units => (jsondata["units"] ?? "") as String;
|
||||
|
||||
// Get the number of units being build for this Part
|
||||
double get building => double.tryParse(jsondata['building'].toString()) ?? 0;
|
||||
double get building => double.tryParse(jsondata["building"].toString()) ?? 0;
|
||||
|
||||
// Get the number of BOM items in this Part (if it is an assembly)
|
||||
int get bomItemCount => (jsondata['bom_items'] ?? 0) as int;
|
||||
int get bomItemCount => (jsondata["bom_items"] ?? 0) as int;
|
||||
|
||||
// Get the number of BOMs this Part is used in (if it is a component)
|
||||
int get usedInCount => (jsondata['used_in'] ?? 0) as int;
|
||||
int get usedInCount => (jsondata["used_in"] ?? 0) as int;
|
||||
|
||||
bool get isAssembly => (jsondata['assembly'] ?? false) as bool;
|
||||
bool get isAssembly => (jsondata["assembly"] ?? false) as bool;
|
||||
|
||||
bool get isComponent => (jsondata['component'] ?? false) as bool;
|
||||
bool get isComponent => (jsondata["component"] ?? false) as bool;
|
||||
|
||||
bool get isPurchaseable => (jsondata['purchaseable'] ?? false) as bool;
|
||||
bool get isPurchaseable => (jsondata["purchaseable"] ?? false) as bool;
|
||||
|
||||
bool get isSalable => (jsondata['salable'] ?? false) as bool;
|
||||
bool get isSalable => (jsondata["salable"] ?? false) as bool;
|
||||
|
||||
bool get isActive => (jsondata['active'] ?? false) as bool;
|
||||
bool get isActive => (jsondata["active"] ?? false) as bool;
|
||||
|
||||
bool get isVirtual => (jsondata['virtual'] ?? false) as bool;
|
||||
bool get isVirtual => (jsondata["virtual"] ?? false) as bool;
|
||||
|
||||
bool get isTrackable => (jsondata['trackable'] ?? false) as bool;
|
||||
bool get isTrackable => (jsondata["trackable"] ?? false) as bool;
|
||||
|
||||
// Get the IPN (internal part number) for the Part instance
|
||||
String get IPN => (jsondata['IPN'] ?? '') as String;
|
||||
String get IPN => (jsondata["IPN"] ?? "") as String;
|
||||
|
||||
// Get the revision string for the Part instance
|
||||
String get revision => (jsondata['revision'] ?? '') as String;
|
||||
String get revision => (jsondata["revision"] ?? "") as String;
|
||||
|
||||
// Get the category ID for the Part instance (or 'null' if does not exist)
|
||||
int get categoryId => (jsondata['category'] ?? -1) as int;
|
||||
// Get the category ID for the Part instance (or "null" if does not exist)
|
||||
int get categoryId => (jsondata["category"] ?? -1) as int;
|
||||
|
||||
// Get the category name for the Part instance
|
||||
String get categoryName {
|
||||
// Inavlid category ID
|
||||
if (categoryId <= 0) return '';
|
||||
if (categoryId <= 0) return "";
|
||||
|
||||
if (!jsondata.containsKey('category_detail')) return '';
|
||||
if (!jsondata.containsKey("category_detail")) return "";
|
||||
|
||||
return (jsondata['category_detail']?['name'] ?? '') as String;
|
||||
return (jsondata["category_detail"]?["name"] ?? "") as String;
|
||||
}
|
||||
|
||||
// Get the category description for the Part instance
|
||||
String get categoryDescription {
|
||||
// Invalid category ID
|
||||
if (categoryId <= 0) return '';
|
||||
if (categoryId <= 0) return "";
|
||||
|
||||
if (!jsondata.containsKey('category_detail')) return '';
|
||||
if (!jsondata.containsKey("category_detail")) return "";
|
||||
|
||||
return (jsondata['category_detail']?['description'] ?? '') as String;
|
||||
return (jsondata["category_detail"]?["description"] ?? "") as String;
|
||||
}
|
||||
// Get the image URL for the Part instance
|
||||
String get _image => (jsondata['image'] ?? '') as String;
|
||||
String get _image => (jsondata["image"] ?? "") as String;
|
||||
|
||||
// Get the thumbnail URL for the Part instance
|
||||
String get _thumbnail => (jsondata['thumbnail'] ?? '') as String;
|
||||
String get _thumbnail => (jsondata["thumbnail"] ?? "") as String;
|
||||
|
||||
// Return the fully-qualified name for the Part instance
|
||||
String get fullname {
|
||||
|
||||
String fn = (jsondata['full_name'] ?? '') as String;
|
||||
String fn = (jsondata["full_name"] ?? "") as String;
|
||||
|
||||
if (fn.isNotEmpty) return fn;
|
||||
|
||||
@ -369,15 +367,15 @@ class InvenTreePart extends InvenTreeModel {
|
||||
final APIResponse response = await InvenTreeAPI().uploadFile(
|
||||
url,
|
||||
image,
|
||||
method: 'PATCH',
|
||||
name: 'image',
|
||||
method: "PATCH",
|
||||
name: "image",
|
||||
);
|
||||
|
||||
return response.successful();
|
||||
}
|
||||
|
||||
// Return the "starred" status of this part
|
||||
bool get starred => (jsondata['starred'] ?? false) as bool;
|
||||
bool get starred => (jsondata["starred"] ?? false) as bool;
|
||||
|
||||
InvenTreePart() : super();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:inventree/inventree/company.dart';
|
||||
import 'package:inventree/inventree/part.dart';
|
||||
import "package:inventree/inventree/company.dart";
|
||||
import "package:inventree/inventree/part.dart";
|
||||
|
||||
import 'model.dart';
|
||||
import "package:inventree/inventree/model.dart";
|
||||
|
||||
// TODO: In the future, status codes should be retrieved from the server
|
||||
const int PO_STATUS_PENDING = 10;
|
||||
@ -44,27 +44,27 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||
};
|
||||
}
|
||||
|
||||
String get issueDate => (jsondata['issue_date'] ?? '') as String;
|
||||
String get issueDate => (jsondata["issue_date"] ?? "") as String;
|
||||
|
||||
String get completeDate => (jsondata['complete_date'] ?? '') as String;
|
||||
String get completeDate => (jsondata["complete_date"] ?? "") as String;
|
||||
|
||||
String get creationDate => (jsondata['creation_date'] ?? '') as String;
|
||||
String get creationDate => (jsondata["creation_date"] ?? "") as String;
|
||||
|
||||
String get targetDate => (jsondata['target_date'] ?? '') as String;
|
||||
String get targetDate => (jsondata["target_date"] ?? "") as String;
|
||||
|
||||
int get lineItemCount => (jsondata['line_items'] ?? 0) as int;
|
||||
int get lineItemCount => (jsondata["line_items"] ?? 0) as int;
|
||||
|
||||
bool get overdue => (jsondata['overdue'] ?? false) as bool;
|
||||
bool get overdue => (jsondata["overdue"] ?? false) as bool;
|
||||
|
||||
String get reference => (jsondata['reference'] ?? '') as String;
|
||||
String get reference => (jsondata["reference"] ?? "") as String;
|
||||
|
||||
int get responsibleId => (jsondata['responsible'] ?? -1) as int;
|
||||
int get responsibleId => (jsondata["responsible"] ?? -1) as int;
|
||||
|
||||
int get supplierId => (jsondata['supplier'] ?? -1) as int;
|
||||
int get supplierId => (jsondata["supplier"] ?? -1) as int;
|
||||
|
||||
InvenTreeCompany? get supplier {
|
||||
|
||||
dynamic supplier_detail = jsondata["supplier_detail"] ?? null;
|
||||
dynamic supplier_detail = jsondata["supplier_detail"];
|
||||
|
||||
if (supplier_detail == null) {
|
||||
return null;
|
||||
@ -73,15 +73,15 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
|
||||
}
|
||||
}
|
||||
|
||||
String get supplierReference => (jsondata['supplier_reference'] ?? '') as String;
|
||||
String get supplierReference => (jsondata["supplier_reference"] ?? "") as String;
|
||||
|
||||
int get status => (jsondata['status'] ?? -1) as int;
|
||||
int get status => (jsondata["status"] ?? -1) as int;
|
||||
|
||||
String get statusText => (jsondata['status_text'] ?? '') as String;
|
||||
String get statusText => (jsondata["status_text"] ?? "") as String;
|
||||
|
||||
bool get isOpen => this.status == PO_STATUS_PENDING || this.status == PO_STATUS_PLACED;
|
||||
bool get isOpen => status == PO_STATUS_PENDING || status == PO_STATUS_PLACED;
|
||||
|
||||
bool get isFailed => this.status == PO_STATUS_CANCELLED || this.status == PO_STATUS_LOST || this.status == PO_STATUS_RETURNED;
|
||||
bool get isFailed => status == PO_STATUS_CANCELLED || status == PO_STATUS_LOST || status == PO_STATUS_RETURNED;
|
||||
|
||||
Future<List<InvenTreePOLineItem>> getLineItems() async {
|
||||
|
||||
@ -146,17 +146,17 @@ class InvenTreePOLineItem extends InvenTreeModel {
|
||||
|
||||
bool get isComplete => received >= quantity;
|
||||
|
||||
double get quantity => (jsondata['quantity'] ?? 0) as double;
|
||||
double get quantity => (jsondata["quantity"] ?? 0) as double;
|
||||
|
||||
double get received => (jsondata['received'] ?? 0) as double;
|
||||
double get received => (jsondata["received"] ?? 0) as double;
|
||||
|
||||
double get outstanding => quantity - received;
|
||||
|
||||
String get reference => (jsondata['reference'] ?? '') as String;
|
||||
String get reference => (jsondata["reference"] ?? "") as String;
|
||||
|
||||
int get orderId => (jsondata['order'] ?? -1) as int;
|
||||
int get orderId => (jsondata["order"] ?? -1) as int;
|
||||
|
||||
int get supplierPartId => (jsondata['part'] ?? -1) as int;
|
||||
int get supplierPartId => (jsondata["part"] ?? -1) as int;
|
||||
|
||||
InvenTreePart? get part {
|
||||
dynamic part_detail = jsondata["part_detail"];
|
||||
@ -170,7 +170,7 @@ class InvenTreePOLineItem extends InvenTreeModel {
|
||||
|
||||
InvenTreeSupplierPart? get supplierPart {
|
||||
|
||||
dynamic detail = jsondata["supplier_part_detail"] ?? null;
|
||||
dynamic detail = jsondata["supplier_part_detail"];
|
||||
|
||||
if (detail == null) {
|
||||
return null;
|
||||
@ -179,15 +179,15 @@ class InvenTreePOLineItem extends InvenTreeModel {
|
||||
}
|
||||
}
|
||||
|
||||
double get purchasePrice => double.parse((jsondata['purchase_price'] ?? '') as String);
|
||||
double get purchasePrice => double.parse((jsondata["purchase_price"] ?? "") as String);
|
||||
|
||||
String get purchasePriceCurrency => (jsondata['purchase_price_currency'] ?? '') as String;
|
||||
String get purchasePriceCurrency => (jsondata["purchase_price_currency"] ?? "") as String;
|
||||
|
||||
String get purchasePriceString => (jsondata['purchase_price_string'] ?? '') as String;
|
||||
String get purchasePriceString => (jsondata["purchase_price_string"] ?? "") as String;
|
||||
|
||||
int get destination => (jsondata['destination'] ?? -1) as int;
|
||||
int get destination => (jsondata["destination"] ?? -1) as int;
|
||||
|
||||
Map<String, dynamic> get destinationDetail => (jsondata['destination_detail'] ?? {}) as Map<String, dynamic>;
|
||||
Map<String, dynamic> get destinationDetail => (jsondata["destination_detail"] ?? {}) as Map<String, dynamic>;
|
||||
|
||||
InvenTreePOLineItem() : super();
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import 'dart:io';
|
||||
import "dart:io";
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import "package:device_info_plus/device_info_plus.dart";
|
||||
import "package:package_info_plus/package_info_plus.dart";
|
||||
import "package:sentry_flutter/sentry_flutter.dart";
|
||||
|
||||
import 'package:inventree/api.dart';
|
||||
import "package:inventree/api.dart";
|
||||
|
||||
Future<Map<String, dynamic>> getDeviceInfo() async {
|
||||
|
||||
@ -18,35 +18,35 @@ Future<Map<String, dynamic>> getDeviceInfo() async {
|
||||
final iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
|
||||
device_info = {
|
||||
'name': iosDeviceInfo.name,
|
||||
'model': iosDeviceInfo.model,
|
||||
'systemName': iosDeviceInfo.systemName,
|
||||
'systemVersion': iosDeviceInfo.systemVersion,
|
||||
'localizedModel': iosDeviceInfo.localizedModel,
|
||||
'utsname': iosDeviceInfo.utsname.sysname,
|
||||
'identifierForVendor': iosDeviceInfo.identifierForVendor,
|
||||
'isPhysicalDevice': iosDeviceInfo.isPhysicalDevice,
|
||||
"name": iosDeviceInfo.name,
|
||||
"model": iosDeviceInfo.model,
|
||||
"systemName": iosDeviceInfo.systemName,
|
||||
"systemVersion": iosDeviceInfo.systemVersion,
|
||||
"localizedModel": iosDeviceInfo.localizedModel,
|
||||
"utsname": iosDeviceInfo.utsname.sysname,
|
||||
"identifierForVendor": iosDeviceInfo.identifierForVendor,
|
||||
"isPhysicalDevice": iosDeviceInfo.isPhysicalDevice,
|
||||
};
|
||||
|
||||
} else if (Platform.isAndroid) {
|
||||
final androidDeviceInfo = await deviceInfo.androidInfo;
|
||||
|
||||
device_info = {
|
||||
'type': androidDeviceInfo.type,
|
||||
'model': androidDeviceInfo.model,
|
||||
'device': androidDeviceInfo.device,
|
||||
'id': androidDeviceInfo.id,
|
||||
'androidId': androidDeviceInfo.androidId,
|
||||
'brand': androidDeviceInfo.brand,
|
||||
'display': androidDeviceInfo.display,
|
||||
'hardware': androidDeviceInfo.hardware,
|
||||
'manufacturer': androidDeviceInfo.manufacturer,
|
||||
'product': androidDeviceInfo.product,
|
||||
'version': androidDeviceInfo.version.release,
|
||||
'supported32BitAbis': androidDeviceInfo.supported32BitAbis,
|
||||
'supported64BitAbis': androidDeviceInfo.supported64BitAbis,
|
||||
'supportedAbis': androidDeviceInfo.supportedAbis,
|
||||
'isPhysicalDevice': androidDeviceInfo.isPhysicalDevice,
|
||||
"type": androidDeviceInfo.type,
|
||||
"model": androidDeviceInfo.model,
|
||||
"device": androidDeviceInfo.device,
|
||||
"id": androidDeviceInfo.id,
|
||||
"androidId": androidDeviceInfo.androidId,
|
||||
"brand": androidDeviceInfo.brand,
|
||||
"display": androidDeviceInfo.display,
|
||||
"hardware": androidDeviceInfo.hardware,
|
||||
"manufacturer": androidDeviceInfo.manufacturer,
|
||||
"product": androidDeviceInfo.product,
|
||||
"version": androidDeviceInfo.version.release,
|
||||
"supported32BitAbis": androidDeviceInfo.supported32BitAbis,
|
||||
"supported64BitAbis": androidDeviceInfo.supported64BitAbis,
|
||||
"supportedAbis": androidDeviceInfo.supportedAbis,
|
||||
"isPhysicalDevice": androidDeviceInfo.isPhysicalDevice,
|
||||
};
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
|
||||
|
||||
if (isInDebugMode()) {
|
||||
|
||||
print('----- In dev mode. Not sending message to Sentry.io -----');
|
||||
print("----- In dev mode. Not sending message to Sentry.io -----");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
|
||||
|
||||
Future<void> sentryReportError(dynamic error, dynamic stackTrace) async {
|
||||
|
||||
print('----- Sentry Intercepted error: $error -----');
|
||||
print("----- Sentry Intercepted error: $error -----");
|
||||
print(stackTrace);
|
||||
|
||||
// Errors thrown in development mode are unlikely to be interesting. You can
|
||||
@ -125,7 +125,7 @@ Future<void> sentryReportError(dynamic error, dynamic stackTrace) async {
|
||||
// the report.
|
||||
if (isInDebugMode()) {
|
||||
|
||||
print('----- In dev mode. Not sending report to Sentry.io -----');
|
||||
print("----- In dev mode. Not sending report to Sentry.io -----");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:inventree/inventree/part.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'model.dart';
|
||||
import 'package:inventree/l10.dart';
|
||||
import "dart:async";
|
||||
|
||||
import "package:intl/intl.dart";
|
||||
import "package:inventree/inventree/part.dart";
|
||||
import "package:flutter/cupertino.dart";
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import "package:inventree/inventree/model.dart";
|
||||
import "package:inventree/l10.dart";
|
||||
|
||||
import 'package:inventree/api.dart';
|
||||
import "package:inventree/api.dart";
|
||||
|
||||
|
||||
class InvenTreeStockItemTestResult extends InvenTreeModel {
|
||||
@ -31,19 +29,17 @@ class InvenTreeStockItemTestResult extends InvenTreeModel {
|
||||
};
|
||||
}
|
||||
|
||||
String get key => (jsondata['key'] ?? '') as String;
|
||||
String get key => (jsondata["key"] ?? "") as String;
|
||||
|
||||
String get testName => (jsondata['test'] ?? '') as String;
|
||||
String get testName => (jsondata["test"] ?? "") as String;
|
||||
|
||||
bool get result => (jsondata['result'] ?? false) as bool;
|
||||
bool get result => (jsondata["result"] ?? false) as bool;
|
||||
|
||||
String get value => (jsondata['value'] ?? '') as String;
|
||||
String get value => (jsondata["value"] ?? "") as String;
|
||||
|
||||
String get notes => (jsondata['notes'] ?? '') as String;
|
||||
String get attachment => (jsondata["attachment"] ?? "") as String;
|
||||
|
||||
String get attachment => (jsondata['attachment'] ?? '') as String;
|
||||
|
||||
String get date => (jsondata['date'] ?? '') as String;
|
||||
String get date => (jsondata["date"] ?? "") as String;
|
||||
|
||||
InvenTreeStockItemTestResult() : super();
|
||||
|
||||
@ -204,17 +200,17 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
});
|
||||
}
|
||||
|
||||
String get uid => (jsondata['uid'] ?? '') as String;
|
||||
String get uid => (jsondata["uid"] ?? "") as String;
|
||||
|
||||
int get status => (jsondata['status'] ?? -1) as int;
|
||||
int get status => (jsondata["status"] ?? -1) as int;
|
||||
|
||||
String get packaging => (jsondata["packaging"] ?? '') as String;
|
||||
String get packaging => (jsondata["packaging"] ?? "") as String;
|
||||
|
||||
String get batch => (jsondata["batch"] ?? '') as String;
|
||||
String get batch => (jsondata["batch"] ?? "") as String;
|
||||
|
||||
int get partId => (jsondata['part'] ?? -1) as int;
|
||||
int get partId => (jsondata["part"] ?? -1) as int;
|
||||
|
||||
String get purchasePrice => (jsondata['purchase_price'] ?? '') as String;
|
||||
String get purchasePrice => (jsondata["purchase_price"] ?? "") as String;
|
||||
|
||||
bool get hasPurchasePrice {
|
||||
|
||||
@ -223,14 +219,14 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
return pp.isNotEmpty && pp.trim() != "-";
|
||||
}
|
||||
|
||||
int get purchaseOrderId => (jsondata['purchase_order'] ?? -1) as int;
|
||||
int get purchaseOrderId => (jsondata["purchase_order"] ?? -1) as int;
|
||||
|
||||
int get trackingItemCount => (jsondata['tracking_items'] ?? 0) as int;
|
||||
int get trackingItemCount => (jsondata["tracking_items"] ?? 0) as int;
|
||||
|
||||
// Date of last update
|
||||
DateTime? get updatedDate {
|
||||
if (jsondata.containsKey("updated")) {
|
||||
return DateTime.tryParse((jsondata["updated"] ?? '') as String);
|
||||
return DateTime.tryParse((jsondata["updated"] ?? "") as String);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -250,7 +246,7 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
DateTime? get stocktakeDate {
|
||||
if (jsondata.containsKey("stocktake_date")) {
|
||||
return DateTime.tryParse((jsondata["stocktake_date"] ?? '') as String);
|
||||
return DateTime.tryParse((jsondata["stocktake_date"] ?? "") as String);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -270,45 +266,45 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
String get partName {
|
||||
|
||||
String nm = '';
|
||||
String nm = "";
|
||||
|
||||
// Use the detailed part information as priority
|
||||
if (jsondata.containsKey('part_detail')) {
|
||||
nm = (jsondata['part_detail']['full_name'] ?? '') as String;
|
||||
if (jsondata.containsKey("part_detail")) {
|
||||
nm = (jsondata["part_detail"]["full_name"] ?? "") as String;
|
||||
}
|
||||
|
||||
// Backup if first value fails
|
||||
if (nm.isEmpty) {
|
||||
nm = (jsondata['part__name'] ?? '') as String;
|
||||
nm = (jsondata["part__name"] ?? "") as String;
|
||||
}
|
||||
|
||||
return nm;
|
||||
}
|
||||
|
||||
String get partDescription {
|
||||
String desc = '';
|
||||
String desc = "";
|
||||
|
||||
// Use the detailed part description as priority
|
||||
if (jsondata.containsKey('part_detail')) {
|
||||
desc = (jsondata['part_detail']['description'] ?? '') as String;
|
||||
if (jsondata.containsKey("part_detail")) {
|
||||
desc = (jsondata["part_detail"]["description"] ?? "") as String;
|
||||
}
|
||||
|
||||
if (desc.isEmpty) {
|
||||
desc = (jsondata['part__description'] ?? '') as String;
|
||||
desc = (jsondata["part__description"] ?? "") as String;
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
String get partImage {
|
||||
String img = '';
|
||||
String img = "";
|
||||
|
||||
if (jsondata.containsKey('part_detail')) {
|
||||
img = (jsondata['part_detail']['thumbnail'] ?? '') as String;
|
||||
if (jsondata.containsKey("part_detail")) {
|
||||
img = (jsondata["part_detail"]["thumbnail"] ?? "") as String;
|
||||
}
|
||||
|
||||
if (img.isEmpty) {
|
||||
img = (jsondata['part__thumbnail'] ?? '') as String;
|
||||
img = (jsondata["part__thumbnail"] ?? "") as String;
|
||||
}
|
||||
|
||||
return img;
|
||||
@ -321,63 +317,63 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
String thumb = "";
|
||||
|
||||
thumb = (jsondata['part_detail']?['thumbnail'] ?? '') as String;
|
||||
thumb = (jsondata["part_detail"]?["thumbnail"] ?? "") as String;
|
||||
|
||||
// Use 'image' as a backup
|
||||
// Use "image" as a backup
|
||||
if (thumb.isEmpty) {
|
||||
thumb = (jsondata['part_detail']?['image'] ?? '') as String;
|
||||
thumb = (jsondata["part_detail"]?["image"] ?? "") as String;
|
||||
}
|
||||
|
||||
// Try a different approach
|
||||
if (thumb.isEmpty) {
|
||||
thumb = (jsondata['part__thumbnail'] ?? '') as String;
|
||||
thumb = (jsondata["part__thumbnail"] ?? "") as String;
|
||||
}
|
||||
|
||||
// Still no thumbnail? Use the 'no image' image
|
||||
// Still no thumbnail? Use the "no image" image
|
||||
if (thumb.isEmpty) thumb = InvenTreeAPI.staticThumb;
|
||||
|
||||
return thumb;
|
||||
}
|
||||
|
||||
int get supplierPartId => (jsondata['supplier_part'] ?? -1) as int;
|
||||
int get supplierPartId => (jsondata["supplier_part"] ?? -1) as int;
|
||||
|
||||
String get supplierImage {
|
||||
String thumb = '';
|
||||
String thumb = "";
|
||||
|
||||
if (jsondata.containsKey("supplier_detail")) {
|
||||
thumb = (jsondata['supplier_detail']['supplier_logo'] ?? '') as String;
|
||||
thumb = (jsondata["supplier_detail"]["supplier_logo"] ?? "") as String;
|
||||
}
|
||||
|
||||
return thumb;
|
||||
}
|
||||
|
||||
String get supplierName {
|
||||
String sname = '';
|
||||
String sname = "";
|
||||
|
||||
if (jsondata.containsKey("supplier_detail")) {
|
||||
sname = (jsondata["supplier_detail"]["supplier_name"] ?? '') as String;
|
||||
sname = (jsondata["supplier_detail"]["supplier_name"] ?? "") as String;
|
||||
}
|
||||
|
||||
return sname;
|
||||
}
|
||||
|
||||
String get units {
|
||||
return (jsondata['part_detail']?['units'] ?? '') as String;
|
||||
return (jsondata["part_detail"]?["units"] ?? "") as String;
|
||||
}
|
||||
|
||||
String get supplierSKU {
|
||||
String sku = '';
|
||||
String sku = "";
|
||||
|
||||
if (jsondata.containsKey("supplier_detail")) {
|
||||
sku = (jsondata["supplier_detail"]["SKU"] ?? '') as String;
|
||||
sku = (jsondata["supplier_detail"]["SKU"] ?? "") as String;
|
||||
}
|
||||
|
||||
return sku;
|
||||
}
|
||||
|
||||
String get serialNumber => (jsondata['serial'] ?? '') as String;
|
||||
String get serialNumber => (jsondata["serial"] ?? "") as String;
|
||||
|
||||
double get quantity => double.tryParse(jsondata['quantity'].toString()) ?? 0;
|
||||
double get quantity => double.tryParse(jsondata["quantity"].toString()) ?? 0;
|
||||
|
||||
String get quantityString {
|
||||
|
||||
@ -395,33 +391,33 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
return q;
|
||||
}
|
||||
|
||||
int get locationId => (jsondata['location'] ?? -1) as int;
|
||||
int get locationId => (jsondata["location"] ?? -1) as int;
|
||||
|
||||
bool isSerialized() => serialNumber.isNotEmpty && quantity.toInt() == 1;
|
||||
|
||||
String serialOrQuantityDisplay() {
|
||||
if (isSerialized()) {
|
||||
return 'SN ${serialNumber}';
|
||||
return "SN ${serialNumber}";
|
||||
}
|
||||
|
||||
// Is an integer?
|
||||
if (quantity.toInt() == quantity) {
|
||||
return '${quantity.toInt()}';
|
||||
return "${quantity.toInt()}";
|
||||
}
|
||||
|
||||
return '${quantity}';
|
||||
return "${quantity}";
|
||||
}
|
||||
|
||||
String get locationName {
|
||||
String loc = '';
|
||||
String loc = "";
|
||||
|
||||
if (locationId == -1 || !jsondata.containsKey('location_detail')) return 'Unknown Location';
|
||||
if (locationId == -1 || !jsondata.containsKey("location_detail")) return "Unknown Location";
|
||||
|
||||
loc = (jsondata['location_detail']['name'] ?? '') as String;
|
||||
loc = (jsondata["location_detail"]["name"] ?? "") as String;
|
||||
|
||||
// Old-style name
|
||||
if (loc.isEmpty) {
|
||||
loc = (jsondata['location__name'] ?? '') as String;
|
||||
loc = (jsondata["location__name"] ?? "") as String;
|
||||
}
|
||||
|
||||
return loc;
|
||||
@ -429,9 +425,9 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
|
||||
String get locationPathString {
|
||||
|
||||
if (locationId == -1 || !jsondata.containsKey('location_detail')) return L10().locationNotSet;
|
||||
if (locationId == -1 || !jsondata.containsKey("location_detail")) return L10().locationNotSet;
|
||||
|
||||
String _loc = (jsondata['location_detail']['pathstring'] ?? '') as String;
|
||||
String _loc = (jsondata["location_detail"]["pathstring"] ?? "") as String;
|
||||
|
||||
if (_loc.isNotEmpty) {
|
||||
return _loc;
|
||||
@ -483,7 +479,7 @@ class InvenTreeStockItem extends InvenTreeModel {
|
||||
"pk": "${pk}",
|
||||
"quantity": "${q}",
|
||||
},
|
||||
"notes": notes ?? '',
|
||||
"notes": notes ?? "",
|
||||
},
|
||||
expectedStatusCode: 200
|
||||
);
|
||||
@ -540,7 +536,7 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
@override
|
||||
String get URL => "stock/location/";
|
||||
|
||||
String get pathstring => (jsondata['pathstring'] ?? '') as String;
|
||||
String get pathstring => (jsondata["pathstring"] ?? "") as String;
|
||||
|
||||
@override
|
||||
Map<String, dynamic> formFields() {
|
||||
@ -553,13 +549,13 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
|
||||
String get parentpathstring {
|
||||
// TODO - Drive the refactor tractor through this
|
||||
List<String> psplit = pathstring.split('/');
|
||||
List<String> psplit = pathstring.split("/");
|
||||
|
||||
if (psplit.length > 0) {
|
||||
psplit.removeLast();
|
||||
}
|
||||
|
||||
String p = psplit.join('/');
|
||||
String p = psplit.join("/");
|
||||
|
||||
if (p.isEmpty) {
|
||||
p = "Top level stock location";
|
||||
@ -568,7 +564,7 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
return p;
|
||||
}
|
||||
|
||||
int get itemcount => (jsondata['items'] ?? 0) as int;
|
||||
int get itemcount => (jsondata["items"] ?? 0) as int;
|
||||
|
||||
InvenTreeStockLocation() : super();
|
||||
|
||||
|
Reference in New Issue
Block a user