2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 20:25:26 +00:00

Barcode workflow (#485)

* Refactor stock barcode operations into new file

* Add setting to control confirmation of stock transfer actions

* Update details when scannign stock item

* Confirm movement when moving items into location

* Cleanup
This commit is contained in:
Oliver
2024-04-18 22:53:21 +10:00
committed by GitHub
parent a889417fe0
commit 4499f3e00e
14 changed files with 403 additions and 281 deletions

View File

@ -145,6 +145,50 @@ class InvenTreeStockItem extends InvenTreeModel {
@override
List<String> get rolesRequired => ["stock"];
// Return a set of fields to transfer this stock item via dialog
Map<String, dynamic> transferFields() {
Map<String, dynamic> fields = {
"pk": {
"parent": "items",
"nested": true,
"hidden": true,
"value": pk,
},
"quantity": {
"parent": "items",
"nested": true,
"value": quantity,
},
"location": {
"value": locationId,
},
"status": {
"parent": "items",
"nested": true,
"value": status,
},
"packaging": {
"parent": "items",
"nested": true,
"value": packaging,
},
"notes": {},
};
if (isSerialized()) {
// Prevent editing of 'quantity' field if the item is serialized
fields["quantity"]["hidden"] = true;
}
// Old API does not support these fields
if (!api.supportsStockAdjustExtraFields) {
fields.remove("packaging");
fields.remove("status");
}
return fields;
}
// URLs for performing stock actions
static String transferStockUrl() => "stock/transfer/";