mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-12 02:05:29 +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:
@ -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 {
|
||||
|
||||
|
Reference in New Issue
Block a user