Skip to content

Commit 192144c

Browse files
committed
MAGETWO-44432: [GITHUB] Manage stock on Product level --> Use Config Settings is never checked by default #2141
1 parent 4b19b98 commit 192144c

File tree

1 file changed

+8
-2
lines changed
  • app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field

1 file changed

+8
-2
lines changed

app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ protected function _getJs($quantityFieldId, $inStockFieldId)
188188
'{$inStockFieldId}': 'inventory_stock_availability'
189189
};
190190
191+
var qtyDefaultValue = qty.val();
191192
var disabler = function(event) {
192193
if (typeof(event) === 'undefined') {
193194
return;
@@ -197,8 +198,13 @@ protected function _getJs($quantityFieldId, $inStockFieldId)
197198
if (stockBeforeDisable.result !== false) {
198199
var manageStockValue = {$isNewProduct}
199200
? (qty.val() === '' ? 0 : 1)
200-
: parseInt(manageStockField.val()),
201-
stockAssociations = $('#' + fieldsAssociations['{$inStockFieldId}']);
201+
: parseInt(manageStockField.val());
202+
if ({$isNewProduct} && qtyDefaultValue !== null && qtyDefaultValue === qty.val()) {
203+
manageStockValue = parseInt(manageStockField.val());
204+
} else {
205+
qtyDefaultValue = null;
206+
}
207+
var stockAssociations = $('#' + fieldsAssociations['{$inStockFieldId}']);
202208
stockAvailabilityField.prop('disabled', !manageStockValue);
203209
stockAssociations.prop('disabled', !manageStockValue);
204210
if ($(event.currentTarget).attr('id') === qty.attr('id') && event.type != 'change') {

0 commit comments

Comments
 (0)