task made mandatory in project

This commit is contained in:
Neil Trini Lasrado 2015-03-31 15:56:21 +05:30
parent a11770f06f
commit aabf150423
2 changed files with 12 additions and 4 deletions

View File

@ -130,7 +130,8 @@
"label": "Tasks",
"options": "Project Task",
"permlevel": 0,
"precision": ""
"precision": "",
"reqd": 0
},
{
"fieldname": "percent_complete",
@ -278,7 +279,7 @@
"icon": "icon-puzzle-piece",
"idx": 1,
"max_attachments": 4,
"modified": "2015-03-30 08:42:33.940104",
"modified": "2015-03-31 06:12:03.372091",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",

View File

@ -34,11 +34,18 @@ class Project(Document):
return ret
def validate(self):
self.validate_dates()
self.validate_tasks()
self.sync_tasks()
def validate_dates(self):
if self.project_start_date and self.completion_date:
if getdate(self.completion_date) < getdate(self.project_start_date):
frappe.throw(_("Expected Completion Date can not be less than Project Start Date"))
self.sync_tasks()
def validate_tasks(self):
if not self.tasks:
frappe.throw("Task is mandatory against a project")
def sync_tasks(self):
"""sync tasks and remove table"""