This commit is contained in:
lizandrogd
2026-01-20 01:01:32 -05:00
parent 58ed9609e1
commit 3709078404
3 changed files with 87 additions and 7 deletions
+1 -4
View File
@@ -166,10 +166,7 @@ class InventarioPrendaDistribucion extends Model
\DB::table('producto_bodega')->insert(['producto_id' => $productoId, 'bodega_id' => $bodegaId, 'stock' => $cantidad, 'created_at' => now(), 'updated_at' => now()]);
}
$prod = \App\Models\Producto::find($productoId);
if ($prod && ! $prod->variants()->exists()) {
$prod->increment('stock', $cantidad);
}
// Nota: No incrementamos el stock global del producto aquí — el stock global ya se incrementó cuando se creó el InventarioPrenda.
// Reducir disponibilidad en inventario_prenda
$parent = $dist->inventarioPrenda;