mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
New barcode actions (#218)
* Bump release notes * Adds method for linking custom barcodes * Custom getter method for determining if an item has barcode data * Add method to check if the API supports "modern" barcodes * Refactor custom barcode implementation for StockItem - Needs testing * Unit testing for linking and unlinking barcodes * Fixes * Refactor code for "custom barcode action" tile * Add custom barcode action to StockLocation * Add extra debug to debug the debugging * Unit test fix * Change scope I guess? * remove handler test
This commit is contained in:
parent
efb6fc353e
commit
730521fd00
11 changed files with 162 additions and 134 deletions
|
|
@ -148,6 +148,23 @@ class InvenTreeModel {
|
|||
// Legacy API provided external link as "URL", while newer API uses "link"
|
||||
String get link => (jsondata["link"] ?? jsondata["URL"] ?? "") as String;
|
||||
|
||||
/* Extract any custom barcode data available for the model.
|
||||
* Note that old API used 'uid' (only for StockItem),
|
||||
* but this was updated to use 'barcode_hash'
|
||||
*/
|
||||
String get customBarcode {
|
||||
if (jsondata.containsKey("uid")) {
|
||||
return jsondata["uid"] as String;
|
||||
} else if (jsondata.containsKey("barcode_hash")) {
|
||||
return jsondata["barcode_hash"] as String;
|
||||
} else if (jsondata.containsKey("barcode")) {
|
||||
return jsondata["barcode"] as String;
|
||||
}
|
||||
|
||||
// Empty string if no match
|
||||
return "";
|
||||
}
|
||||
|
||||
Future <void> goToInvenTreePage() async {
|
||||
|
||||
if (await canLaunch(webUrl)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue