task-rescheduling - handled exception if date is None

This commit is contained in:
Neil Trini Lasrado 2015-04-23 13:12:18 +05:30
parent 46d859e694
commit fa381c7a6c

View File

@ -90,6 +90,7 @@ class Task(Document):
def reschedule_depending_task(self):
for task_name in frappe.db.sql("select name from `tabTask` where depends_on = %s", self.name, as_dict=1):
task = frappe.get_doc("Task", task_name.name)
if task.exp_start_date and task.exp_end_date and (self.exp_end_date or self.act_end_date):
task_duration = date_diff(task.exp_end_date, task.exp_start_date)
task.exp_start_date = add_days(self.act_end_date if self.act_end_date else self.exp_end_date, 1)
task.exp_end_date = add_days(task.exp_start_date, task_duration)