It's that neutral building? Because if it isn't, you can first set a trainable unit (different instance, same icon) for this building (stats - units trained), when the research is being completed, remove the avalaibilty of this unit and add avalaibility of the sold unit.