Merge pull request #17778 from tuxgasy/fix_check_stock_with_batch

Fix: Do a strict comparison when check if stock is enough
This commit is contained in:
Laurent Destailleur 2021-06-04 10:34:29 +02:00 committed by GitHub
commit 7608f0b383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -355,7 +355,9 @@ class MouvementStock extends CommonObject
$qtyisnotenough = 0;
foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch)
{
if ($batch != $batchcursor) continue;
if ((string) $batch != (string) $batchcursor) { // Lot '59' must be different than lot '59c'
continue;
}
$foundforbatch = 1;
if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty;
break;