Updated the closed signal in the task model to close the milestone of the saved task if all us have task and all are closed

remotes/origin/enhancement/email-actions
David Barragán Merino 2013-11-11 18:45:39 +01:00
parent 8d56f7efc8
commit 649df99977
1 changed files with 3 additions and 2 deletions

View File

@ -146,8 +146,9 @@ def tasks_close_handler(sender, instance, **kwargs):
# Milestone # Milestone
if instance.milestone: if instance.milestone:
if instance.status.is_closed and not instance.milestone.closed and all([ if (instance.status.is_closed and not instance.milestone.closed and
t.status.is_closed for t in instance.milestone.tasks.all()]): all([t.status.is_closed for t in instance.milestone.tasks.all()]) and
all([us.status.is_closed for us in instance.milestone.user_stories.all()])):
instance.milestone.closed = True instance.milestone.closed = True
instance.milestone.save() instance.milestone.save()
elif not instance.status.is_closed and instance.milestone.closed: elif not instance.status.is_closed and instance.milestone.closed: