mirror of
https://github.com/inventree/inventree-app.git
synced 2026-11-23 14:16:08 +00:00
Dead code (#935)
* fix release notes styling * remove legacy code Removes checks for API versions that the app no longer supports
This commit is contained in:
1 parent
4a72da8e3e
commit
3c14c0cc0e
25 files changed
+142
-272
No files matched your search
+17
-17
@@ -23,7 +23,7 @@
|
||||
- Add "reference" ordering for BOM list
|
||||
- Bug fix for list widget ordering
|
||||
|
||||
## 1.0.0 - November 2026
|
||||
### 1.0.0 - November 2026
|
||||
---
|
||||
|
||||
- Login now uses secure sessions, matching the web interface (API tokens are no longer used)
|
||||
@@ -35,7 +35,7 @@
|
||||
- Requires InvenTree server API version 314 or newer - existing users must log in again
|
||||
- Updated translations
|
||||
|
||||
## 0.26.0 - October 2026
|
||||
### 0.26.0 - October 2026
|
||||
---
|
||||
|
||||
- Supports new multi-note API for model instances
|
||||
@@ -45,7 +45,7 @@
|
||||
- Adds support for separate "pricing" permission set
|
||||
- Updated translations
|
||||
|
||||
## 0.25.2 - September 2026
|
||||
### 0.25.2 - September 2026
|
||||
---
|
||||
|
||||
- On stock transfer, add a merge option.
|
||||
@@ -53,28 +53,28 @@
|
||||
- Bug fix for top level stock display
|
||||
- Bug fix for top level location display
|
||||
|
||||
## 0.25.1 - August 2026
|
||||
### 0.25.1 - August 2026
|
||||
---
|
||||
|
||||
- Additional filtering options for supplier parts
|
||||
- Additional barcode support using data intents
|
||||
- Improvements for build order display
|
||||
|
||||
## 0.25.0 - July 2026
|
||||
### 0.25.0 - July 2026
|
||||
---
|
||||
|
||||
- API speed improvements
|
||||
- Enable scanning of Build Order barcodes
|
||||
- Updated translations
|
||||
|
||||
## 0.24.3 - May 2026
|
||||
### 0.24.3 - May 2026
|
||||
---
|
||||
|
||||
- Update file and image selection packages
|
||||
- Check for app updates
|
||||
- Updated translations
|
||||
|
||||
## 0.24.2 - May 2026
|
||||
### 0.24.2 - May 2026
|
||||
---
|
||||
|
||||
- Display user information in the app drawer
|
||||
@@ -82,47 +82,47 @@
|
||||
- Moves notifications to the top of the screen
|
||||
- Updated translations
|
||||
|
||||
## 0.24.1 - April 2026
|
||||
### 0.24.1 - April 2026
|
||||
---
|
||||
|
||||
- Fixes bug which prevented label printing
|
||||
|
||||
## 0.24.0 - April 2026
|
||||
### 0.24.0 - April 2026
|
||||
---
|
||||
|
||||
- Adds support for build order management
|
||||
- Updated translations
|
||||
|
||||
## 0.23.0 - April 2026
|
||||
### 0.23.0 - April 2026
|
||||
---
|
||||
|
||||
- Fixes image artifact issues for iOS devices
|
||||
- Update underlying Flutter version
|
||||
|
||||
## 0.22.7 - March 2026
|
||||
### 0.22.7 - March 2026
|
||||
---
|
||||
|
||||
- Bug fix for loading sales order shipments
|
||||
|
||||
## 0.22.6 - March 2026
|
||||
### 0.22.6 - March 2026
|
||||
---
|
||||
|
||||
- Fix for displaying stock item test results
|
||||
|
||||
## 0.22.5 - March 2026
|
||||
### 0.22.5 - March 2026
|
||||
---
|
||||
|
||||
- Fix default value for "cascade" filter in PartCategory list view
|
||||
- Fix default value for "cascade" filter in StockLocation list view
|
||||
|
||||
## 0.22.4 - March 2026
|
||||
### 0.22.4 - March 2026
|
||||
---
|
||||
|
||||
- Adds button to check server connection
|
||||
- Fixes bug fetching sales order shipments
|
||||
- Fix for boolean fields in API forms
|
||||
|
||||
## 0.22.3 - February 2026
|
||||
### 0.22.3 - February 2026
|
||||
---
|
||||
|
||||
- Auto-fill location data when receiving item via barcode scan
|
||||
@@ -130,12 +130,12 @@
|
||||
- Add support for tri-state boolean form fields
|
||||
- Bug fixes for refreshing list view data
|
||||
|
||||
## 0.22.2 - February 2026
|
||||
### 0.22.2 - February 2026
|
||||
---
|
||||
|
||||
- Bug fix for label printing, which used improperly formatted URL
|
||||
|
||||
## 0.22.1 - February 2026
|
||||
### 0.22.1 - February 2026
|
||||
---
|
||||
|
||||
- Fixes bug related to fetching images from remote URLs
|
||||
|
||||
+3
-23
@@ -326,28 +326,8 @@ class InvenTreeAPI {
|
||||
* These functions are used to determine if the server supports a particular feature
|
||||
*/
|
||||
|
||||
// Does the server support "active" status on Company and SupplierPart API endpoints?
|
||||
bool get supportsCompanyActiveStatus => apiVersion >= 189;
|
||||
|
||||
// Does the server support the "modern" (consolidated) label printing API?
|
||||
bool get supportsModernLabelPrinting => apiVersion >= 201;
|
||||
|
||||
// Does the server support the "modern" (consolidated) attachment API?
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/7420
|
||||
bool get supportsModernAttachments => apiVersion >= 207;
|
||||
|
||||
bool get supportsUserPermissions => apiVersion >= 207;
|
||||
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/7514
|
||||
bool get supportsTopLevelFiltering => apiVersion >= 209;
|
||||
|
||||
// Does the server support the "destination" field on the PurchaseOrder model?
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/8403
|
||||
bool get supportsPurchaseOrderDestination => apiVersion >= 276;
|
||||
|
||||
// Does the server support the "start_date" field for orders?
|
||||
// Ref: https://github.com/inventree/InvenTree/pull/8966
|
||||
bool get supportsStartDate => apiVersion >= 306;
|
||||
// Note: Features available at the minimum supported API version
|
||||
// (see _minApiVersion) do not require a version check
|
||||
|
||||
// Supports separate search against "supplier" / "customer" / "manufacturer"
|
||||
bool get supportsSplitCompanySearch => apiVersion >= 315;
|
||||
@@ -972,7 +952,7 @@ class InvenTreeAPI {
|
||||
|
||||
roles = (data["roles"] ?? {}) as Map<String, dynamic>;
|
||||
|
||||
if (supportsUserPermissions && data.containsKey("permissions")) {
|
||||
if (data.containsKey("permissions")) {
|
||||
permissions = (data["permissions"] ?? {}) as Map<String, dynamic>;
|
||||
} else {
|
||||
permissions = {};
|
||||
|
||||
@@ -90,10 +90,6 @@ class InvenTreeAttachment extends InvenTreeModel {
|
||||
Future<int> countAttachments(String modelType, int modelId) async {
|
||||
Map<String, String> filters = {};
|
||||
|
||||
if (!api.supportsModernAttachments) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
filters["model_type"] = modelType;
|
||||
filters["model_id"] = modelId.toString();
|
||||
|
||||
|
||||
@@ -46,12 +46,9 @@ class InvenTreeCompany extends InvenTreeModel {
|
||||
"is_manufacturer": {},
|
||||
"is_customer": {},
|
||||
"currency": {},
|
||||
"active": {},
|
||||
};
|
||||
|
||||
if (InvenTreeAPI().supportsCompanyActiveStatus) {
|
||||
fields["active"] = {};
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
@@ -144,19 +141,10 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
"link": {},
|
||||
"note": {},
|
||||
"packaging": {},
|
||||
"pack_quantity": {},
|
||||
"active": {},
|
||||
};
|
||||
|
||||
// At some point, pack_size was changed to pack_quantity
|
||||
if (InvenTreeAPI().apiVersion < 117) {
|
||||
fields["pack_size"] = {};
|
||||
} else {
|
||||
fields["pack_quantity"] = {};
|
||||
}
|
||||
|
||||
if (InvenTreeAPI().supportsCompanyActiveStatus) {
|
||||
fields["active"] = {};
|
||||
}
|
||||
|
||||
if (InvenTreeAPI().supportsSupplierPartPrimaryField) {
|
||||
fields["primary"] = {};
|
||||
}
|
||||
@@ -224,13 +212,7 @@ class InvenTreeSupplierPart extends InvenTreeModel {
|
||||
|
||||
String get packaging => getString("packaging");
|
||||
|
||||
String get pack_quantity {
|
||||
if (InvenTreeAPI().apiVersion < 117) {
|
||||
return getString("pack_size");
|
||||
} else {
|
||||
return getString("pack_quantity");
|
||||
}
|
||||
}
|
||||
String get pack_quantity => getString("pack_quantity");
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -912,18 +912,7 @@ class InvenTreePlugin extends InvenTreeModel {
|
||||
InvenTreePlugin.fromJson(json);
|
||||
|
||||
@override
|
||||
String get URL {
|
||||
/* Note: The plugin API endpoint changed at API version 90,
|
||||
* < 90 = 'plugin'
|
||||
* >= 90 = 'plugins'
|
||||
* Ref: https://github.com/inventree/InvenTree/pull/4186
|
||||
*/
|
||||
if (api.isConnected() && api.apiVersion < 90) {
|
||||
return "plugin/";
|
||||
} else {
|
||||
return "plugins/";
|
||||
}
|
||||
}
|
||||
String get URL => "plugins/";
|
||||
|
||||
String get key => getString("key");
|
||||
|
||||
|
||||
@@ -38,11 +38,6 @@ class InvenTreeNotification extends InvenTreeModel {
|
||||
* Dismiss this notification (mark as read)
|
||||
*/
|
||||
Future<void> dismiss() async {
|
||||
if (api.apiVersion >= 82) {
|
||||
// "Modern" API endpoint operates a little differently
|
||||
await update(values: {"read": "true"});
|
||||
} else {
|
||||
await api.post("${url}read/");
|
||||
}
|
||||
await update(values: {"read": "true"});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/helpers.dart";
|
||||
import "package:inventree/inventree/company.dart";
|
||||
import "package:inventree/inventree/model.dart";
|
||||
@@ -63,14 +62,6 @@ class InvenTreePurchaseOrder extends InvenTreeOrder {
|
||||
},
|
||||
};
|
||||
|
||||
if (!InvenTreeAPI().supportsPurchaseOrderDestination) {
|
||||
fields.remove("destination");
|
||||
}
|
||||
|
||||
if (!InvenTreeAPI().supportsStartDate) {
|
||||
fields.remove("start_date");
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/helpers.dart";
|
||||
|
||||
import "package:inventree/inventree/company.dart";
|
||||
@@ -62,10 +61,6 @@ class InvenTreeSalesOrder extends InvenTreeOrder {
|
||||
},
|
||||
};
|
||||
|
||||
if (!InvenTreeAPI().supportsStartDate) {
|
||||
fields.remove("start_date");
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
||||
@@ -331,12 +331,6 @@ Future<void> selectAndPrintLabel(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!InvenTreeAPI().supportsModernLabelPrinting) {
|
||||
// Legacy label printing API not supported
|
||||
showSnackIcon("Label printing not supported by server", success: false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch default values for label printing
|
||||
|
||||
// Default template
|
||||
|
||||
@@ -2,7 +2,6 @@ import "dart:io";
|
||||
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/inventree/attachment.dart";
|
||||
import "package:inventree/widget/link_icon.dart";
|
||||
import "package:one_context/one_context.dart";
|
||||
@@ -253,7 +252,7 @@ class _AttachmentWidgetState extends RefreshableState<AttachmentWidget> {
|
||||
/*
|
||||
* Return a ListTile to display attachments for the specified model
|
||||
*/
|
||||
ListTile? ShowAttachmentsItem(
|
||||
ListTile ShowAttachmentsItem(
|
||||
BuildContext context,
|
||||
String modelType,
|
||||
int modelId,
|
||||
@@ -261,10 +260,6 @@ ListTile? ShowAttachmentsItem(
|
||||
int attachmentCount,
|
||||
bool hasUploadPermission,
|
||||
) {
|
||||
if (!InvenTreeAPI().supportsModernAttachments) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ListTile(
|
||||
title: Text(L10().attachments),
|
||||
leading: Icon(TablerIcons.file, color: COLOR_ACTION),
|
||||
|
||||
@@ -637,19 +637,17 @@ class _BuildOrderDetailState extends RefreshableState<BuildOrderDetailWidget> {
|
||||
}
|
||||
|
||||
// Attachments tile
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeBuildOrder.MODEL_TYPE,
|
||||
widget.order.pk,
|
||||
widget.order.reference,
|
||||
attachmentCount,
|
||||
widget.order.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeBuildOrder.MODEL_TYPE,
|
||||
widget.order.pk,
|
||||
widget.order.reference,
|
||||
attachmentCount,
|
||||
widget.order.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -428,19 +428,17 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
||||
tiles.add(parameterTile);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeCompany.MODEL_TYPE,
|
||||
widget.company.pk,
|
||||
widget.company.name,
|
||||
attachmentCount,
|
||||
widget.company.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeCompany.MODEL_TYPE,
|
||||
widget.company.pk,
|
||||
widget.company.name,
|
||||
attachmentCount,
|
||||
widget.company.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
}
|
||||
@@ -94,13 +94,11 @@ class _CompanyListState extends PaginatedSearchState<PaginatedCompanyList> {
|
||||
Map<String, Map<String, dynamic>> get filterOptions {
|
||||
Map<String, Map<String, dynamic>> filters = {};
|
||||
|
||||
if (InvenTreeAPI().supportsCompanyActiveStatus) {
|
||||
filters["active"] = {
|
||||
"label": L10().filterActive,
|
||||
"help_text": L10().filterActiveDetail,
|
||||
"tristate": true,
|
||||
};
|
||||
}
|
||||
filters["active"] = {
|
||||
"label": L10().filterActive,
|
||||
"help_text": L10().filterActiveDetail,
|
||||
"tristate": true,
|
||||
};
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
@@ -230,19 +230,17 @@ class _ManufacturerPartDisplayState
|
||||
tiles.add(parameterTile);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeManufacturerPart.MODEL_TYPE,
|
||||
widget.manufacturerPart.pk,
|
||||
widget.manufacturerPart.MPN,
|
||||
attachmentCount,
|
||||
widget.manufacturerPart.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeManufacturerPart.MODEL_TYPE,
|
||||
widget.manufacturerPart.pk,
|
||||
widget.manufacturerPart.MPN,
|
||||
attachmentCount,
|
||||
widget.manufacturerPart.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
}
|
||||
@@ -362,19 +362,17 @@ class _SupplierPartDisplayState
|
||||
tiles.add(parameterTile);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeSupplierPart.MODEL_TYPE,
|
||||
widget.supplierPart.pk,
|
||||
widget.supplierPart.SKU,
|
||||
attachmentCount,
|
||||
widget.supplierPart.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeSupplierPart.MODEL_TYPE,
|
||||
widget.supplierPart.pk,
|
||||
widget.supplierPart.SKU,
|
||||
attachmentCount,
|
||||
widget.supplierPart.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
}
|
||||
@@ -57,13 +57,11 @@ class _PaginatedSupplierPartListState
|
||||
Map<String, Map<String, dynamic>> get filterOptions {
|
||||
Map<String, Map<String, dynamic>> filters = {};
|
||||
|
||||
if (InvenTreeAPI().supportsCompanyActiveStatus) {
|
||||
filters["active"] = {
|
||||
"label": L10().filterActive,
|
||||
"help_text": L10().filterActiveDetail,
|
||||
"tristate": true,
|
||||
};
|
||||
}
|
||||
filters["active"] = {
|
||||
"label": L10().filterActive,
|
||||
"help_text": L10().filterActiveDetail,
|
||||
"tristate": true,
|
||||
};
|
||||
|
||||
if (InvenTreeAPI().supportsSupplierPartPrimaryField) {
|
||||
filters["primary"] = {
|
||||
|
||||
@@ -322,8 +322,7 @@ class _PurchaseOrderDetailState
|
||||
}
|
||||
});
|
||||
|
||||
if (api.supportsPurchaseOrderDestination &&
|
||||
widget.order.destinationId > 0) {
|
||||
if (widget.order.destinationId > 0) {
|
||||
InvenTreeStockLocation().get(widget.order.destinationId).then((
|
||||
InvenTreeModel? loc,
|
||||
) {
|
||||
@@ -593,19 +592,17 @@ class _PurchaseOrderDetailState
|
||||
tiles.add(parameterTile);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreePurchaseOrder.MODEL_TYPE,
|
||||
widget.order.pk,
|
||||
widget.order.reference,
|
||||
attachmentCount,
|
||||
widget.order.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreePurchaseOrder.MODEL_TYPE,
|
||||
widget.order.pk,
|
||||
widget.order.reference,
|
||||
attachmentCount,
|
||||
widget.order.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -518,19 +518,17 @@ class _SalesOrderDetailState extends RefreshableState<SalesOrderDetailWidget> {
|
||||
tiles.add(parameterTile);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeSalesOrder.MODEL_TYPE,
|
||||
widget.order.pk,
|
||||
widget.order.reference,
|
||||
attachmentCount,
|
||||
widget.order.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeSalesOrder.MODEL_TYPE,
|
||||
widget.order.pk,
|
||||
widget.order.reference,
|
||||
attachmentCount,
|
||||
widget.order.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,19 +354,17 @@ class _SOShipmentDetailWidgetState
|
||||
);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeSalesOrderShipment.MODEL_TYPE,
|
||||
widget.shipment.pk,
|
||||
widget.shipment.reference,
|
||||
attachmentCount,
|
||||
widget.shipment.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeSalesOrderShipment.MODEL_TYPE,
|
||||
widget.shipment.pk,
|
||||
widget.shipment.reference,
|
||||
attachmentCount,
|
||||
widget.shipment.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_speed_dial/flutter_speed_dial.dart";
|
||||
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
||||
import "package:inventree/api.dart";
|
||||
|
||||
import "package:inventree/app_colors.dart";
|
||||
import "package:inventree/l10.dart";
|
||||
@@ -195,11 +194,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||
if (parent != null) {
|
||||
filters["parent"] = parent.toString();
|
||||
} else {
|
||||
if (InvenTreeAPI().supportsTopLevelFiltering) {
|
||||
filters["top_level"] = "true";
|
||||
} else {
|
||||
filters["parent"] = "null";
|
||||
}
|
||||
filters["top_level"] = "true";
|
||||
}
|
||||
|
||||
List<Widget> tiles = <Widget>[
|
||||
|
||||
@@ -6,7 +6,6 @@ import "package:inventree/widget/link_icon.dart";
|
||||
import "package:inventree/widget/paginator.dart";
|
||||
import "package:inventree/widget/refreshable_state.dart";
|
||||
|
||||
import "package:inventree/api.dart";
|
||||
import "package:inventree/l10.dart";
|
||||
|
||||
class PartCategoryList extends StatefulWidget {
|
||||
@@ -66,20 +65,12 @@ class _PaginatedPartCategoryListState
|
||||
|
||||
@override
|
||||
Map<String, String> get orderingOptions {
|
||||
Map<String, String> options = {
|
||||
return {
|
||||
"name": L10().name,
|
||||
"pathstring": L10().path,
|
||||
"level": L10().level,
|
||||
"part_count": L10().parts,
|
||||
};
|
||||
|
||||
// Note: API v69 changed 'parts' to 'part_count'
|
||||
if (InvenTreeAPI().apiVersion >= 69) {
|
||||
options["part_count"] = L10().parts;
|
||||
} else {
|
||||
options["parts"] = L10().parts;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -124,7 +124,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
if (allowLabelPrinting && api.supportsModernLabelPrinting) {
|
||||
if (allowLabelPrinting) {
|
||||
actions.add(
|
||||
SpeedDialChild(
|
||||
child: Icon(TablerIcons.printer),
|
||||
@@ -221,17 +221,15 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
}
|
||||
|
||||
// Request the number of attachments
|
||||
if (api.supportsModernAttachments) {
|
||||
InvenTreeAttachment()
|
||||
.countAttachments(InvenTreePart.MODEL_TYPE, part.pk)
|
||||
.then((int value) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
attachmentCount = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
InvenTreeAttachment()
|
||||
.countAttachments(InvenTreePart.MODEL_TYPE, part.pk)
|
||||
.then((int value) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
attachmentCount = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Request the number of parameters
|
||||
if (api.supportsModernParameters) {
|
||||
@@ -749,19 +747,17 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
tiles.add(parameterTile);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreePart.MODEL_TYPE,
|
||||
part.pk,
|
||||
L10().part,
|
||||
attachmentCount,
|
||||
part.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreePart.MODEL_TYPE,
|
||||
part.pk,
|
||||
L10().part,
|
||||
attachmentCount,
|
||||
part.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:flutter_speed_dial/flutter_speed_dial.dart";
|
||||
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
||||
import "package:inventree/api.dart";
|
||||
|
||||
import "package:inventree/app_colors.dart";
|
||||
import "package:inventree/barcode/barcode.dart";
|
||||
@@ -178,9 +177,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
if (widget.location != null &&
|
||||
allowLabelPrinting &&
|
||||
api.supportsModernLabelPrinting) {
|
||||
if (widget.location != null && allowLabelPrinting) {
|
||||
actions.add(
|
||||
SpeedDialChild(
|
||||
child: Icon(TablerIcons.printer),
|
||||
@@ -361,11 +358,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
||||
if (parent != null) {
|
||||
filters["parent"] = parent.toString();
|
||||
} else {
|
||||
if (InvenTreeAPI().supportsTopLevelFiltering) {
|
||||
filters["top_level"] = "true";
|
||||
} else {
|
||||
filters["parent"] = "null";
|
||||
}
|
||||
filters["top_level"] = "true";
|
||||
}
|
||||
|
||||
List<Widget> tiles = [
|
||||
|
||||
@@ -128,7 +128,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
if (allowLabelPrinting && api.supportsModernLabelPrinting) {
|
||||
if (allowLabelPrinting) {
|
||||
actions.add(
|
||||
SpeedDialChild(
|
||||
child: Icon(TablerIcons.printer),
|
||||
@@ -825,19 +825,17 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
ListTile? attachmentTile = ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeStockItem.MODEL_TYPE,
|
||||
widget.item.pk,
|
||||
L10().stockItem,
|
||||
attachmentCount,
|
||||
widget.item.canEdit,
|
||||
tiles.add(
|
||||
ShowAttachmentsItem(
|
||||
context,
|
||||
InvenTreeStockItem.MODEL_TYPE,
|
||||
widget.item.pk,
|
||||
L10().stockItem,
|
||||
attachmentCount,
|
||||
widget.item.canEdit,
|
||||
),
|
||||
);
|
||||
|
||||
if (attachmentTile != null) {
|
||||
tiles.add(attachmentTile);
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
}
|
||||
@@ -648,9 +648,6 @@ void main() {
|
||||
});
|
||||
|
||||
test("Company Form Fields", () async {
|
||||
expect(InvenTreeCompany().formFields().containsKey("active"), isFalse);
|
||||
|
||||
InvenTreeAPI().serverInfo = {"apiVersion": 189};
|
||||
expect(InvenTreeCompany().formFields().containsKey("active"), isTrue);
|
||||
});
|
||||
|
||||
@@ -677,14 +674,16 @@ void main() {
|
||||
expect(sp.active, isTrue);
|
||||
expect(sp.primary, isFalse);
|
||||
|
||||
// Older API versions use "pack_size"
|
||||
expect(sp.pack_quantity, equals("10"));
|
||||
expect(sp.formFields().containsKey("pack_size"), isTrue);
|
||||
expect(sp.pack_quantity, equals("1 reel"));
|
||||
expect(sp.formFields().containsKey("pack_quantity"), isTrue);
|
||||
expect(sp.formFields().containsKey("pack_size"), isFalse);
|
||||
expect(sp.formFields().containsKey("active"), isTrue);
|
||||
|
||||
// The "primary" field requires API v456
|
||||
InvenTreeAPI().serverInfo = {"apiVersion": 455};
|
||||
expect(sp.formFields().containsKey("primary"), isFalse);
|
||||
|
||||
InvenTreeAPI().serverInfo = {"apiVersion": 456};
|
||||
expect(sp.pack_quantity, equals("1 reel"));
|
||||
expect(sp.formFields().containsKey("pack_quantity"), isTrue);
|
||||
expect(sp.formFields().containsKey("primary"), isTrue);
|
||||
|
||||
// Missing images
|
||||
|
||||
Reference in new issue
Block a user