mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-14 03:05:32 +00:00
Pre-fill the "location" field when receiving an item
This commit is contained in:
@ -178,16 +178,10 @@ class InvenTreePOLineItem extends InvenTreeOrderLine {
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> defaultGetFilters() {
|
||||
return {
|
||||
"part_detail": "true",
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> defaultListFilters() {
|
||||
Map<String, String> defaultFilters() {
|
||||
return {
|
||||
"part_detail": "true",
|
||||
"order_detail": "true",
|
||||
};
|
||||
}
|
||||
|
||||
@ -228,6 +222,8 @@ class InvenTreePOLineItem extends InvenTreeOrderLine {
|
||||
|
||||
int get destinationId => getInt("destination");
|
||||
|
||||
Map<String, dynamic> get orderDetail => getMap("order_detail");
|
||||
|
||||
Map<String, dynamic> get destinationDetail => getMap("destination_detail");
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,13 @@ class _POLineDetailWidgetState extends RefreshableState<POLineDetailWidget> {
|
||||
// Launch a form to 'receive' this line item
|
||||
Future<void> receiveLineItem(BuildContext context) async {
|
||||
|
||||
// Pre-fill the "destination" to receive into
|
||||
int destination = widget.item.destinationId;
|
||||
|
||||
if (destination < 0) {
|
||||
destination = (widget.item.orderDetail["destination"] ?? -1) as int;
|
||||
}
|
||||
|
||||
// Construct fields to receive
|
||||
Map<String, dynamic> fields = {
|
||||
"line_item": {
|
||||
@ -164,6 +171,10 @@ class _POLineDetailWidgetState extends RefreshableState<POLineDetailWidget> {
|
||||
}
|
||||
};
|
||||
|
||||
if (destination > 0) {
|
||||
fields["location"]?["value"] = destination;
|
||||
}
|
||||
|
||||
showLoadingOverlay(context);
|
||||
var order = await InvenTreePurchaseOrder().get(widget.item.orderId);
|
||||
hideLoadingOverlay();
|
||||
|
Reference in New Issue
Block a user