mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Part pricing detail (#655)
* Implement part pricing data and new part pricing widget * improve part pricing widget and part pricing data. Add part pricing setting. * Refactor helper func * Tweak translated string * Refactor part pricing page * Update release notes * Fixes * More cleanup --------- Co-authored-by: JarEXE <eykenj@gmail.com>
This commit is contained in:
parent
13cb2f9164
commit
13abcae84c
10 changed files with 437 additions and 13 deletions
|
|
@ -142,7 +142,7 @@ class InvenTreeModel {
|
|||
}
|
||||
|
||||
// Helper function to get double value from JSON data
|
||||
double getDouble(String key, {double backup = 0.0, String subKey = ""}) {
|
||||
double? getDoubleOrNull(String key, {double? backup, String subKey = ""}) {
|
||||
dynamic value = getValue(key, backup: backup, subKey: subKey);
|
||||
|
||||
if (value == null) {
|
||||
|
|
@ -152,6 +152,11 @@ class InvenTreeModel {
|
|||
return double.tryParse(value.toString()) ?? backup;
|
||||
}
|
||||
|
||||
double getDouble(String key, {double backup = 0.0, String subkey = "" }) {
|
||||
double? value = getDoubleOrNull(key, backup: backup, subKey: subkey);
|
||||
return value ?? backup;
|
||||
}
|
||||
|
||||
// Helper function to get boolean value from json data
|
||||
bool getBool(String key, {bool backup = false, String subKey = ""}) {
|
||||
dynamic value = getValue(key, backup: backup, subKey: subKey);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue