Fix printing label per unit

If a product allows label printing per unit, the current code prevents you from setting "stock entry label" to "label per unit" on the purchase page because the option is disabled. Only a single label can be printed.

Even if you set the product default to "label per unit" and don't change it on the purchase page, the selection is ignored because the option is disabled, so `jsonForm.print_stock_label` is undefined. In this case, no labels are printed at all because the value is undefined.

This change enables/disables the option in the correct cases.
This commit is contained in:
joshvazquez 2021-10-10 13:17:49 -07:00 committed by GitHub
parent ea63246a12
commit 3a997ac8dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -313,11 +313,11 @@ if (Grocy.Components.ProductPicker !== undefined)
{ {
$("#default_print_stock_label").val("0"); $("#default_print_stock_label").val("0");
} }
$('#label-option-per-unit').prop("disabled", true); $('#label-option-per-unit').prop("disabled", false);
} }
else else
{ {
$('#label-option-per-unit').prop("disabled", false); $('#label-option-per-unit').prop("disabled", true);
} }
} }