The buyer takes the property subject to the lease
California Civil Code section 821 gives a buyer who takes property subject to a lease the same rights to collect rent and enforce the lease. The sale alone does not end the rental agreement or set a tenant's move-out date. If possession needs to change, the lease and applicable notice and possession process still matter.
Read California Civil Code section 821