Custom doctype status field

for my sprint doctype when all the task are completed sprint must be completed. and the project also.How can I manage this. Now it shows draft please help me

Have you written any script to update status in the Sprint from backend? If yes, please share the code which is not working.

Message

status cannot be “Closed”. It should be one of “Open”, “Closed”, “Cancelled”, “Completed”