magento / inventory

Magento Inventory Project (a.k.a MSI)
Open Software License 3.0
337 stars 248 forks source link

Invoice is not being generated for virtual products after delete that product from admin #3381

Closed imran9935 closed 9 months ago

imran9935 commented 1 year ago

Preconditions (*)

I have tested it only below mentioned magento versions,and issue is reproducible.

  1. Magento - 2.4.5-p1
  2. Inventory - 1.2.3
  3. Magento - 2.4.6
  4. Inventory - 1.2.4

Description (*)

When we try to create invoice of deleted virtual product then it gives the error like “Following products with requested skus were not found: sku” (screenshot), as invoice generate perfectly for simple product after delete the simple products.

image

Steps to reproduce (*)

  1. Go to admin panel and create a virtual product.
  2. Place the order of that virtual product.
  3. Delete that virtual product from admin and reindex it.
  4. Try to generate invoice of that virtual product then observe.

Expected result (*)

The deleted virtual product invoice should be generated, as it works perfectly for simple products.

Actual result (*)

Deleted product invoice is not being generated for virtual products.

Additional information (*)

  1. As we have checked that when we delete product from the admin then product is not being deleted from inventory_source_item table as this issue (https://github.com/magento/magento2/issues/36992). is still exists in Magento 2.4.5-p1 and 2.4.6, As we have seen that after remove the deleted products data from inventory_source_item table then invoice is being generated perfectly.

  2. As we have checked and found that the deleted sku is still coming in this variable $notFoundedSkus inside execute method in this file Magento\InventoryCatalog\Model\GetProductIdsBySkus that’s why it is giving the error during invoice for deleted virtual products.

m2-assistant[bot] commented 1 year ago

Hi @imran9935. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

Kashyap1999 commented 9 months ago

Hi @imran9935, There is a configuration "Synchronize with Catalog" located in Stores > Configuration > Catalog > Inventory > Stock Options. This setting automatically synchronizes inventory data according to catalog changes. this configuration will run the consumer "inventory.source.items.cleanup" when catalog changes occur. after enabling this setting your issue has been solved. Now you can close this issue.