Hecke conjectured that $\theta_I$ form a basis for the space $S_2(p)$, but this was found to fail for $p=37$ by Eichler.  In fact, Gross realized that whenever you get vanishing central $L$-values you get a linear relation among theta series.  This happens in $S_2(37)$ since there is an elliptic curve with root number $-1$ of conductor 37.

However, Eichler showed you can find a basis for the space of modular forms among the theta series attached to lattices $J^{-1}I$ as $I, J$ vary over left $O$-ideals (so you range over left $O'$-ideals where $O'$ ranges over _all_ maximal orders).  The precise linear relations are mysterious however.  See for instance the introduction to Hijikata, Pizer and Shemanske's _Memoirs_ article on the basis problem.