State tax on capital gain for selling a property in old state after moving to a new state

I moved permanently from California to Oklahoma in July.

I have a property (my primary residence in California) which is listed by my agent before I leave. 

The property actually got sold in early August.

 

I prepare to file state tax for CA and OK as part-year residents.

I know that I have to pay the income tax for selling this property (since the profit > 500k) to CA.

But my question is do I need to pay income tax for the profit of selling the property to OK?

Also if I sold the property before I leave CA, do I need to pay tax to OK?