diff --git a/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/ui_component/product_form.xml index fe91beace806f..22d683a78865e 100644 --- a/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/ui_component/product_form.xml @@ -7,6 +7,11 @@ -->
+ + + advanced_inventory_button + + true diff --git a/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/web/js/product/form/source-items.js b/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/web/js/product/form/source-items.js index acb4d9227afe9..71a5cd028b839 100644 --- a/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/web/js/product/form/source-items.js +++ b/app/code/Magento/InventoryCatalogAdminUi/view/adminhtml/web/js/product/form/source-items.js @@ -4,12 +4,15 @@ */ define([ - 'Magento_Ui/js/form/components/fieldset' -], function (Fieldset) { + 'Magento_Ui/js/form/components/fieldset', + 'uiRegistry', + 'underscore' +], function (Fieldset, registry, _) { 'use strict'; return Fieldset.extend({ defaults: { + advancedInventoryButtonIndex: '', imports: { onStockChange: '${ $.provider }:data.product.stock_data.manage_stock' } @@ -20,8 +23,16 @@ define([ * @param {Integer} canManageStock */ onStockChange: function (canManageStock) { + var advancedInventoryButton = registry.get('index = ' + this.advancedInventoryButtonIndex); + if (canManageStock === 0) { this.delegate('disabled', true); + // "Advanced Inventory" button should stay active in any case. + if (!_.isUndefined(advancedInventoryButton)) { + advancedInventoryButton.disabled(false); + } + } else { + this.delegate('disabled', false); } } });