2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 04:05:28 +00:00

Display and edit project code for purchase orders

This commit is contained in:
Oliver Walters
2023-04-21 21:05:03 +10:00
parent 340c3ba766
commit 8d1f6161fa
6 changed files with 44 additions and 1 deletions

View File

@ -43,6 +43,8 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
int attachmentCount = 0;
bool supportProjectCodes = false;
@override
String getAppBarTitle() => L10().purchaseOrder;
@ -139,6 +141,8 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
lines = await order.getLineItems();
supportProjectCodes = api.supportsProjectCodes && await api.getGlobalBooleanSetting("PROJECT_CODES_ENABLED");
completedLines = 0;
for (var line in lines) {
@ -157,12 +161,20 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
// Edit the currently displayed PurchaseOrder
Future <void> editOrder(BuildContext context) async {
var fields = order.formFields();
// Cannot edit supplier field from here
fields.remove("supplier");
// Contact model not supported by server
if (!api.supportsContactModel) {
fields.remove("contact");
}
// ProjectCode model not supported by server
if (!supportProjectCodes) {
fields.remove("project_code");
}
order.editForm(
context,
L10().purchaseOrderEdit,
@ -202,6 +214,14 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
tiles.add(headerTile(context));
if (supportProjectCodes && order.hasProjectCode) {
tiles.add(ListTile(
title: Text(L10().projectCode),
subtitle: Text("${order.projectCode} - ${order.projectCodeDescription}"),
leading: FaIcon(FontAwesomeIcons.list),
));
}
if (supplier != null) {
tiles.add(ListTile(
title: Text(L10().supplier),