Qays bin Abu Hazim reported,

Mughira bin Shuba led us in prayer. He stood up after the second rak'ah without sitting for the tashahhud. We said, "Glory be to Allah." He gestured with his hand and said, "Glory be to Allah," and continued his prayer. When he finished his prayer and gave the salam, he performed two prostrations while seated. Then he said, "The Messenger of Allah ﷺ led us in prayer and rose to stand from his sitting, continuing his prayer. When he finished his prayer, he performed two prostrations while seated. Then he said, 'When one of you prays and rises from the sitting position, if he has not yet stood fully upright, let him sit back down, and there is no need for the two prostrations. But if he has stood fully upright, let him continue his prayer and then perform two prostrations while seated.'"

Azami 2480

Sahih

عن قيس بن أبي حازم قال

صلى بنا المغيرة بن شعبة، فقام من الركعتين قائما، فقلنا: سبحان الله، فأومأ وقال: سبحان الله، فمضى في صلاته، فلما قضى صلاته وسلم، سجد سجدتين وهو جالس، ثم قال: صلى بنا رسول الله ﷺ فاستوى قائما من جلوسه، فمضى في صلاته، فلما قضى صلاته سجد سجدتين وهو جالس، ثم قال: إذا صلى أحدكم فقام من الجلوس، فإن لم يستتم قائما فليجلس، وليس عليه سجدتان، فإن استوى قائما فليمض في صلاته، وليسجد سجدتين وهو جالس.

الأعظمي 2480صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Forgetfulness
Section
One who stands from two rakahs, if he has straightened up he should continue, otherwise he should sit
Numbering
Jami al-Kamil 2480 (2nd edition)
Azami 2480