From f09a9f68e4a7834649e9df9b41f03778b38a72bd Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 10 Jun 2013 15:57:52 +0530 Subject: [PATCH] [project] [event] fix in creation of event --- projects/doctype/project/project.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/projects/doctype/project/project.py b/projects/doctype/project/project.py index b519224ab9..94b6787312 100644 --- a/projects/doctype/project/project.py +++ b/projects/doctype/project/project.py @@ -73,17 +73,18 @@ class DocType: # add events for milestone in self.doclist.get({"parentfield": "project_milestones"}): - description = milestone.milestone + " for " + self.doc.name - webnotes.bean({ - "doctype": "Event", - "owner": self.doc.owner, - "subject": description, - "description": description, - "starts_on": milestone.milestone_date + " 10:00:00", - "event_type": "Private", - "ref_type": self.doc.doctype, - "ref_name": self.doc.name - }).insert() + if milestone.milestone_date: + description = (milestone.milestone or "Milestone") + " for " + self.doc.name + webnotes.bean({ + "doctype": "Event", + "owner": self.doc.owner, + "subject": description, + "description": description, + "starts_on": milestone.milestone_date + " 10:00:00", + "event_type": "Private", + "ref_type": self.doc.doctype, + "ref_name": self.doc.name + }).insert() def on_trash(self): self.delete_events()