From 778cf847d32fefa5d6a834acc2b57380dce9ca79 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Wed, 17 May 2023 21:10:14 +0200 Subject: [PATCH] Fixed more missing fields when copying a product (fixes #2231) --- changelog/70_UNRELEASED_xxxx.xx.xx.md | 2 +- public/viewjs/productform.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changelog/70_UNRELEASED_xxxx.xx.xx.md b/changelog/70_UNRELEASED_xxxx.xx.xx.md index 17ac8ddd..01c2793e 100644 --- a/changelog/70_UNRELEASED_xxxx.xx.xx.md +++ b/changelog/70_UNRELEASED_xxxx.xx.xx.md @@ -37,7 +37,7 @@ - Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work - Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved - Fixed that for a product's average price, only currently in-stock items were considered, not already consumed ones -- Fixed that when copying a product, the field "Default consume location" was not copied along +- Fixed that when copying a product, some fields (like "Default consume location" or "Disable own stock) weren't copied along ### Shopping list diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index 7f0dfa5a..2030492b 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -431,6 +431,19 @@ if (Grocy.EditMode == "create" && GetUriParam("copy-of") != undefined) $("#quick_consume_amount").val(sourceProduct.quick_consume_amount); $("#quick_open_amount").val(sourceProduct.quick_open_amount); $("#default_consume_location_id").val(sourceProduct.default_consume_location_id); + if (BoolVal(sourceProduct.no_own_stock)) + { + $("#no_own_stock").prop("checked", true); + } + if (BoolVal(sourceProduct.hide_on_stock_overview)) + { + $("#hide_on_stock_overview").prop("checked", true); + } + if (BoolVal(sourceProduct.auto_reprint_stock_label)) + { + $("#auto_reprint_stock_label").prop("checked", true); + } + $("#default_stock_label_type").val(sourceProduct.default_stock_label_type); Grocy.FrontendHelpers.ValidateForm('product-form'); },