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

Purchase order updates (#456)

* Support supplierpart in related field

* Manual add line item to purchase order

* Update release notes
This commit is contained in:
Oliver
2023-11-15 23:53:47 +11:00
committed by GitHub
parent 1148f01d4a
commit 0a85441131
3 changed files with 60 additions and 6 deletions

View File

@ -74,6 +74,17 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
if (widget.order.canCreate) {
if (widget.order.isPending) {
actions.add(
SpeedDialChild(
child: FaIcon(FontAwesomeIcons.circlePlus, color: Colors.green),
label: L10().lineItemAdd,
onTap: () async {
_addLineItem(context);
}
)
);
actions.add(
SpeedDialChild(
child: FaIcon(FontAwesomeIcons.paperPlane, color: Colors.blue),
@ -101,6 +112,30 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
return actions;
}
/// Add a new line item to this order
Future<void> _addLineItem(BuildContext context) async {
var fields = InvenTreePOLineItem().formFields();
// Update part field definition
fields["part"]?["hidden"] = false;
fields["part"]?["filters"] = {
"supplier": widget.order.supplierId
};
fields["order"]?["value"] = widget.order.pk;
InvenTreePOLineItem().createForm(
context,
L10().lineItemAdd,
fields: fields,
onSuccess: (data) async {
refresh(context);
showSnackIcon(L10().lineItemUpdated, success: true);
}
);
}
/// Issue this order
Future<void> _issueOrder(BuildContext context) async {