magento2-disable-stock-reservation
magento2-disable-stock-reservation copied to clipboard
When the creditmemo is created, the stock quantity decreases
Proposed fix:
diff --git a/vendor/ampersand/magento2-disable-stock-reservation/src/Model/SourceDeductionService/PatchedSourceDeductionService.php b/vendor/ampersand/magento2-disable-stock-reservation/src/Model/SourceDeductionService/PatchedSourceDeductionService.php
--- a/vendor/ampersand/magento2-disable-stock-reservation/src/Model/SourceDeductionService/PatchedSourceDeductionService.php
+++ b/vendor/ampersand/magento2-disable-stock-reservation/src/Model/SourceDeductionService/PatchedSourceDeductionService.php
@@ -99,6 +99,21 @@
$sourceItem->setStatus($stockStatus);
continue;
}
+ } else if ($salesEvent->getType() ==
+ \Magento\InventorySalesApi\Api\Data\SalesEventInterface::EVENT_CREDITMEMO_CREATED) {
+ if ($qty < 0) {
+ $sourceItem->setQuantity($sourceItem->getQuantity() - $qty);
+ $stockStatus = $this->getSourceStockStatus(
+ $stockItemConfiguration,
+ $sourceItem
+ );
+ $sourceItem->setStatus($stockStatus);
+ $sourceItemDecrementData[] = [
+ 'source_item' => $sourceItem,
+ 'qty_to_decrement' => $qty
+ ];
+ }
+ continue;
}
/*
* Ampersand change finish
Hey @ConradoSM what version of magento please?
2.4.6-p1
Before order place:
After order place:
After create creditmemo:
I'm having the same issue that @ConradoSM mentioned.
Tested on magento 2.4.5-p2, ampersand/magento2-disable-stock-reservation 1.3.0
Hi all, just doing due diligence and confirming this is still an issue? It feels recent enough to consider it so. @ConradoSM any chance you may be able to fork this repository and make a pull request back in with your patch for approval? Thanks
I am having same issue on 2.4.4-p8, ampersand/magento2-disable-stock-reservation 1.3.2
Applying patch from @ConradoSM prevented inventory from being reduced.