mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 22:16:47 +00:00
Fix dialog for manual stock transfer
This commit is contained in:
parent
988e394404
commit
6e115dd3bf
@ -246,7 +246,6 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
|
|
||||||
void _transferStock(BuildContext context, InvenTreeStockLocation location) async {
|
void _transferStock(BuildContext context, InvenTreeStockLocation location) async {
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
double quantity = double.parse(_quantityController.text);
|
double quantity = double.parse(_quantityController.text);
|
||||||
String notes = _notesController.text;
|
String notes = _notesController.text;
|
||||||
@ -254,13 +253,13 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
_quantityController.clear();
|
_quantityController.clear();
|
||||||
_notesController.clear();
|
_notesController.clear();
|
||||||
|
|
||||||
var response = await item.transferStock(location.pk, quantity: quantity, notes: notes);
|
var result = await item.transferStock(location.pk, quantity: quantity, notes: notes);
|
||||||
|
|
||||||
// TODO - Error handling (potentially return false?)
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
// TODO - Display a snackbar here indicating the action was successful (or otherwise)
|
if (result) {
|
||||||
|
showSnackIcon("Stock item transferred", success: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _transferStockDialog() async {
|
void _transferStockDialog() async {
|
||||||
@ -274,16 +273,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
showFormDialog(I18N.of(context).transferStock,
|
showFormDialog(I18N.of(context).transferStock,
|
||||||
key: _moveStockKey,
|
key: _moveStockKey,
|
||||||
actions: <Widget>[
|
callback: () {
|
||||||
FlatButton(
|
_transferStock(context, selectedLocation);
|
||||||
child: Text(I18N.of(context).transfer),
|
},
|
||||||
onPressed: () {
|
|
||||||
if (_moveStockKey.currentState.validate()) {
|
|
||||||
_moveStockKey.currentState.save();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
fields: <Widget>[
|
fields: <Widget>[
|
||||||
QuantityField(
|
QuantityField(
|
||||||
label: I18N.of(context).quantity,
|
label: I18N.of(context).quantity,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user