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

MSI-2043: disabled source selection when disabled manage stock #2049

Conversation

VitaliyBoyko
Copy link
Contributor

@VitaliyBoyko VitaliyBoyko commented Feb 20, 2019

Description

Disabled source selection algorithm when managing stock is disabled.

Fixed Issues (if relevant)

  1. Cannot create shipment: Source item not found by source code: default and sku: [my-sku custom option] #2043: Cannot create shipment: Source item not found by source code: default and SKU: [my-sku custom option]

Manual testing scenarios

1

  1. Create multiple sources and stocks
  2. Create a product and assign it to the custom sources.
  3. Disable stock managing Stores > Configuration > Catalog > Inventory > Product Stock Options > Manage Stock
  4. Create an order with the product
  5. Create and submit a shipment
    SSA page shouldn't be shown.

2

  1. Create multiple sources and stocks
  2. Create a product and assign it to the custom sources.
  3. Disable stock managing for Product via Advanced Inventory
  4. Create an order with the product
  5. Create and submit a shipment
    SSA page shouldn't be shown.

3

  1. Create multiple sources and stocks
  2. Create 2 products and assign them to the custom sources.
  3. Disable stock managing for 1 Product via Advanced Inventory
  4. Create an order with both products
  5. SSA page should be shown.
    The issue with select sources for this scenario fixed in the scope of MSI-1912: Get sku from order configurable product with custom options #2012.

@adarshkhatri
Copy link

I think we need to check this:

        if (!$this->stockConfiguration->getManageStock()) {
            return;
        }

for each product, instead of entire site.

@VitaliyBoyko
Copy link
Contributor Author

Seems like we have to implement service which will check if the order has at least one stock manageable item. And show SSA according to result. And on SSA level we have to add the check whether item stock manageable or not. @maghamed I'm right?

@maghamed
Copy link
Contributor

@VitaliyBoyko not sure that we need to introduce a dedicated service for these purposes.
Just okay to introduce dedicated class which would use InventoryConfiguration inside

@adarshkhatri
Copy link

It looks like there is check in place:

        if (!$stockItemConfiguration->isManageStock()) {
            //We don't need to Manage Stock
            continue;
        }

https://github.com/magento-engcom/msi/blob/2.3-develop/app/code/Magento/InventorySourceDeductionApi/Model/SourceDeductionService.php#L76

I think solution would be to find the list by product id instead of sku. I see that when creating order Magento adds Custom Option to the configurable item, when it has custom option

For example:
Config item's sku: Config Item with Custom Option
Child Item: Config Item with Custom Option-Black-First

But when order created:
db

Because of this, system will never find the product.

   //namespace Magento\InventorySourceDeductionApi\Model\GetSourceItemBySourceCodeAndSku

    $searchCriteria = $this->searchCriteriaBuilder
        ->addFilter(SourceItemInterface::SOURCE_CODE, $sourceCode) //default
        ->addFilter(SourceItemInterface::SKU, $sku) //Config Item with Custom Option-Black-First Custom Option
        ->create();
    $sourceItemsResult = $this->sourceItemRepository->getList($searchCriteria);

I think, finding the source item by product id will always find the product if it exist.

@maghamed maghamed removed their assignment Apr 8, 2019
…-engcom/msi into MSI-2043-disable-source-selection-when-disabled-manage-stock

Conflicts:
	app/code/Magento/InventoryShippingAdminUi/Observer/NewShipmentLoadBefore.php
@malesh-v
Copy link
Contributor

I've checked the first case, I click Ship and SSA page isn't showing(as expected) but if a click Back SSA page loads.

@VitaliyBoyko
Copy link
Contributor Author

Hi @ishakhsuvarov
I've added the mentioned changes.
Thank you!

@ishakhsuvarov ishakhsuvarov merged commit 62238e4 into 2.3-develop Apr 16, 2019
@ghost
Copy link

ghost commented Apr 16, 2019

Hi @VitaliyBoyko, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ishakhsuvarov ishakhsuvarov deleted the MSI-2043-disable-source-selection-when-disabled-manage-stock branch June 19, 2019 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants