Skip to content

Commit a0b8795

Browse files
Allow purchase orders to be completed directly from the app (#686)
* Allow purchase orders to be completed directly from the app * Code formatting
1 parent 7d32bd6 commit a0b8795

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ We enforce consistent code formatting using Dart's built-in formatter. Before su
2727
1. Fork the repository and create a feature branch
2828
2. Make your changes
2929
3. Ensure your code passes all tests and linting
30-
4. Format your code using `fvm dart format`
30+
4. Format your code using `invoke format`
3131
5. Submit a pull request with a clear description of the changes
3232
6. Address any review comments
3333

assets/release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### TBD - ???
22
---
33

4+
- Allow purchase orders to be completed
45
- Improved UX across the entire app
56
- Fix bug which prevented display of part images for purchase order line items
67

lib/l10n/app_en.arb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@
261261
"companies": "Companies",
262262
"@companies": {},
263263

264+
"complete": "Complete",
265+
"@complete": {},
266+
267+
"completeOrder": "Complete Order",
268+
"@completeOrder": {},
269+
264270
"completionDate": "Completion Date",
265271
"@completionDate": {},
266272

lib/widget/order/purchase_order_detail.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "package:flutter/material.dart";
22
import "package:flutter_speed_dial/flutter_speed_dial.dart";
33
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
4+
import "package:inventree/api_form.dart";
45

56
import "package:inventree/app_colors.dart";
67
import "package:inventree/barcode/barcode.dart";
@@ -122,6 +123,18 @@ class _PurchaseOrderDetailState
122123
);
123124
}
124125

126+
if (widget.order.isOpen && !widget.order.isPending) {
127+
actions.add(
128+
SpeedDialChild(
129+
child: Icon(TablerIcons.circle_check, color: Colors.green),
130+
label: L10().completeOrder,
131+
onTap: () async {
132+
_completeOrder(context);
133+
},
134+
),
135+
);
136+
}
137+
125138
if (widget.order.isOpen) {
126139
actions.add(
127140
SpeedDialChild(
@@ -182,6 +195,24 @@ class _PurchaseOrderDetailState
182195
);
183196
}
184197

198+
/// Complete this order
199+
Future<void> _completeOrder(BuildContext context) async {
200+
Map<String, Map<String, dynamic>> fields = {"accept_incomplete": {}};
201+
202+
String URL = "order/po/${widget.order.pk}/complete/";
203+
204+
launchApiForm(
205+
context,
206+
L10().completeOrder,
207+
URL,
208+
fields,
209+
method: "POST",
210+
onSuccess: (data) async {
211+
refresh(context);
212+
},
213+
);
214+
}
215+
185216
/// Cancel this order
186217
Future<void> _cancelOrder(BuildContext context) async {
187218
confirmationDialog(

tasks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
from invoke import task
66

77

8+
@task
9+
def format(c):
10+
"""Code formatting using dart format."""
11+
c.run("fvm dart format lib")
12+
813
@task
914
def clean(c):
1015
"""Clean flutter build."""

0 commit comments

Comments
 (0)