mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 10:45:29 +00:00
Barcode updates (#211)
* Adds API function for unlinking a barcode * Show barcode unlink result * Update release notes and version number
This commit is contained in:
@ -417,25 +417,43 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Unassign (remove) a barcode from a StockItem.
|
||||
*
|
||||
* Note that for API version < 76 this action is performed on the StockItem endpoint.
|
||||
* For API version 76 or above, this uses the barcode "unlink" endpoint
|
||||
*/
|
||||
Future<void> _unassignBarcode(BuildContext context) async {
|
||||
|
||||
final response = await item.update(values: {"uid": ""});
|
||||
if (InvenTreeAPI().apiVersion < 76) {
|
||||
final response = await item.update(values: {"uid": ""});
|
||||
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
case 201:
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateSuccess,
|
||||
success: true
|
||||
);
|
||||
break;
|
||||
default:
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateFailure,
|
||||
success: false,
|
||||
);
|
||||
break;
|
||||
switch (response.statusCode) {
|
||||
case 200:
|
||||
case 201:
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateSuccess,
|
||||
success: true
|
||||
);
|
||||
break;
|
||||
default:
|
||||
showSnackIcon(
|
||||
L10().stockItemUpdateFailure,
|
||||
success: false,
|
||||
);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
final bool result = await InvenTreeAPI().unlinkBarcode({
|
||||
"stockitem": item.pk,
|
||||
});
|
||||
|
||||
showSnackIcon(
|
||||
result ? L10().stockItemUpdateSuccess : L10().stockItemUpdateFailure,
|
||||
success: result,
|
||||
);
|
||||
}
|
||||
|
||||
refresh(context);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user