mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 10:45:29 +00:00
Project code support (#336)
* Determine if project codes are supported * Add helpers for boolean functions * Adds helper methods for generic "model" class - Will allow us to do some good refactoring * Refactor the refactor * Add debug support and getMap function * Major refactoring for model data accessors * Handle null values * Add sentry reporting if key is used incorrectly * Fix typo * Refactor createFromJson function * Add model for ProjectCode * Display and edit project code for purchase orders
This commit is contained in:
15
lib/api.dart
15
lib/api.dart
@ -300,6 +300,9 @@ class InvenTreeAPI {
|
||||
// Order barcodes API v107 or newer
|
||||
bool get supportsOrderBarcodes => isConnected() && apiVersion >= 107;
|
||||
|
||||
// Project codes require v109 or newer
|
||||
bool get supportsProjectCodes => isConnected() && apiVersion >= 109;
|
||||
|
||||
// Are plugins enabled on the server?
|
||||
bool _pluginsEnabled = false;
|
||||
|
||||
@ -1362,6 +1365,12 @@ class InvenTreeAPI {
|
||||
}
|
||||
}
|
||||
|
||||
// Return a boolean global setting value
|
||||
Future<bool> getGlobalBooleanSetting(String key) async {
|
||||
String value = await getGlobalSetting(key);
|
||||
return value.toLowerCase() == "true";
|
||||
}
|
||||
|
||||
Future<String> getUserSetting(String key) async {
|
||||
if (!supportsSettings) return "";
|
||||
|
||||
@ -1382,6 +1391,12 @@ class InvenTreeAPI {
|
||||
}
|
||||
}
|
||||
|
||||
// Return a boolean user setting value
|
||||
Future<bool> getUserBooleanSetting(String key) async {
|
||||
String value = await getUserSetting(key);
|
||||
return value.toLowerCase() == "true";
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a request to the server to locate / identify either a StockItem or StockLocation
|
||||
*/
|
||||
|
Reference in New Issue
Block a user