-
Notifications
You must be signed in to change notification settings - Fork 248
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
Inventory reservation list inconsistencies command does not work #2522
Comments
In addition to this when I run the command inventory:reservation:list-inconsistencies, I receive the following fatal error, using Magento 2.3.2: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Inventory\Model\ResourceModel\IsProductAssignedToStock::execute() must be of the type string, integer given, called in /var/www/vhosts/XXXXXXX/htdocs/vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/FilterManagedStockProducts.php on line 56 and defined in /var/www/vhosts/XXXXXXX/htdocs/vendor/magento/module-inventory/Model/ResourceModel/IsProductAssignedToStock.php:34 |
Having this issue too, SKU is 7438257958967 The salable quantity is HIGHER than the stock, and backorders are DISABLED. |
Same here. ( string error and forever running ) |
Finally I was able to run the command. It turned out that this command needs EXTREMELY large server resources. It will not success on small servers. |
@chrisbadley It says is expecting your passed SKU 1060218 to be a type of string, integer given instead. |
@chrisbadley - I'm having the exact same problem as you. Did you find a solution? |
Not yet, its on my agenda to look into soon, I am assuming that your SKU are totally numerical values also. |
I have a quick fix for you ef1970. In the file: vendor/magento/module-inventory/Model/ResourceModel/IsProductAssignedToStock.php Simply add $sku = "$sku"; at line 52 so the function becomes:
|
@chrisbadley @ef1970 /**
* Remove all reservations with incomplete state
*
* @param SalableQuantityInconsistency[] $inconsistencies
* @return SalableQuantityInconsistency[]
* @throws LocalizedException
* @throws SkuIsNotAssignedToStockException
*/
public function execute(array $inconsistencies): array
{
foreach ($inconsistencies as $inconsistency) {
$filteredItems = [];
foreach ($inconsistency->getItems() as $sku => $qty) {
if (false === $this->isProductAssignedToStock->execute((string)$sku, $inconsistency->getStockId())) {
continue;
}
$stockConfiguration = $this->getStockItemConfiguration->execute((string)$sku, $inconsistency->getStockId());
if ($stockConfiguration->isManageStock()) {
$filteredItems[$sku] = $qty;
}
}
$inconsistency->setItems($filteredItems);
}
return $inconsistencies;
} should fix it temporary, until someone fixes it in prod |
@chrisbadley @moderncodes - thanks for input, this really saved my day. After making your modification, truncating order tables and then manually clearing inventory_reservation table, everything is working as it's supposed to. Pfew ;-) |
Hi All, Is this resolved on latest release or we need to follow temporary solution from @moderncodes ? |
I'm here wondering exactly the same - although I'm running 2.3.4 |
In reply @sudhanshu-bajaj I just updated my instance based on @chrisbadley and @moderncodes code changes above - and it resolves my issue (temporarily). Is this going to be in a release? |
looks like vendor/magento/module-inventory-reservation-cli/Model/SalableQuantityInconsistency/FilterManagedStockProducts.php still not fixed in new magento version, fatal error for numeric sku values |
@albsa Where you able to find the cause/resolve this issue? If so, do you mind sharing the solution please. |
Is there any open issue for this bug? |
Doesn't seem that there's an internal ticket for this issue. We ran into this when we had products with all numeric SKUs and this error cropped up. Seems that for some reason all numeric SKUs are being interpreted as an integer at some point. Casting them to a string when calling the I applied the same changes that @moderncodes posted here and it started working. It's not a permanent fix, but it got me past where I needed to be. |
According to Magento, this has been fixed in MSI 1.2 which is compatible with Magento 2.4. So if you're using Magento < 2.4 you will need to apply the patch. |
The command to list inconsistencies never completes in Magento 2.3.2.
Database size: ~15GB
Order Count: ~1137711
SKU Count: 7788
Preconditions (*)
Steps to reproduce (*)
php -d memory_limit=-1 bin/magento inventory:reservation:list-inconsistencies -ir
Expected result (*)
Actual result (*)
The text was updated successfully, but these errors were encountered: