Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print label key #491

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class InvenTreeAPI {
bool get supportsCompanyActiveStatus => isConnected() && apiVersion >= 189;

// Does the server support the "modern" (consolidated) label printing API?
bool get supportsModenLabelPrinting => isConnected() && apiVersion >= 197;
bool get supportsModernLabelPrinting => isConnected() && apiVersion >= 198;

// Cached list of plugins (refreshed when we connect to the server)
List<InvenTreePlugin> _plugins = [];
Expand Down
6 changes: 3 additions & 3 deletions lib/labels.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Future<void> selectAndPrintLabel(
for (var plugin in plugins) {
plugin_options.add({
"display_name": plugin.humanName,
"value": InvenTreeAPI().supportsModenLabelPrinting ? plugin.pk : plugin.key
"value": plugin.key,
});
}

Expand Down Expand Up @@ -100,7 +100,7 @@ Future<void> selectAndPrintLabel(

showLoadingOverlay(context);

if (InvenTreeAPI().supportsModenLabelPrinting) {
if (InvenTreeAPI().supportsModernLabelPrinting) {

// Modern label printing API uses a POST request to a single API endpoint.
await InvenTreeAPI().post(
Expand Down Expand Up @@ -178,7 +178,7 @@ Future<List<Map<String, dynamic>>> getLabelTemplates(

String url = "/label/template/";

if (InvenTreeAPI().supportsModenLabelPrinting) {
if (InvenTreeAPI().supportsModernLabelPrinting) {
data["model_type"] = labelType;
} else {
// Legacy label printing API endpoint
Expand Down
4 changes: 2 additions & 2 deletions lib/widget/part/part_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {

if (allowLabelPrinting) {

String model_type = api.supportsModenLabelPrinting ? InvenTreePart().MODEL_TYPE : "part";
String item_key = api.supportsModenLabelPrinting ? "items" : "part";
String model_type = api.supportsModernLabelPrinting ? InvenTreePart().MODEL_TYPE : "part";
String item_key = api.supportsModernLabelPrinting ? "items" : "part";

_labels = await getLabelTemplates(
model_type,
Expand Down
4 changes: 2 additions & 2 deletions lib/widget/stock/location_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {

if (widget.location != null) {

String model_type = api.supportsModenLabelPrinting ? InvenTreeStockLocation().MODEL_TYPE : "location";
String item_key = api.supportsModenLabelPrinting ? "items" : "location";
String model_type = api.supportsModernLabelPrinting ? InvenTreeStockLocation().MODEL_TYPE : "location";
String item_key = api.supportsModernLabelPrinting ? "items" : "location";

_labels = await getLabelTemplates(
model_type,
Expand Down
4 changes: 2 additions & 2 deletions lib/widget/stock/stock_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
// Request information on labels available for this stock item
if (allowLabelPrinting) {

String model_type = api.supportsModenLabelPrinting ? InvenTreeStockLocation().MODEL_TYPE : "stock";
String item_key = api.supportsModenLabelPrinting ? "items" : "item";
String model_type = api.supportsModernLabelPrinting ? InvenTreeStockLocation().MODEL_TYPE : "stock";
String item_key = api.supportsModernLabelPrinting ? "items" : "item";

// Clear the existing labels list
_labels = await getLabelTemplates(
Expand Down
Loading