This commit is contained in:
Anurag Mishra 2019-01-04 11:00:07 +05:30
parent f2b29a0488
commit 68aedfd176
2 changed files with 4 additions and 5 deletions

View File

@ -12,7 +12,7 @@ from frappe.utils.nestedset import NestedSet
class CircularReferenceError(frappe.ValidationError): pass
class EndDateCannotGreaterThanProjecteEndDateError(frappe.ValidationError): pass
class EndDateCannotBeGreaterThanProjectEndDateError(frappe.ValidationError): pass
class Task(NestedSet):
nsm_parent_field = 'parent_task'
@ -48,8 +48,7 @@ class Task(NestedSet):
if frappe.db.exists("Project", self.project):
doc = frappe.get_doc("Project", self.project)
if self.exp_end_date and doc.expected_end_date and getdate(self.exp_end_date) > getdate(doc.expected_end_date) :
frappe.msgprint(_("Expected end date cannot be after Project: <b>'{0}'</b> Expected end date").format(doc.name))
raise EndDateCannotGreaterThanProjecteEndDateError
frappe.throw(_("Expected end date cannot be after Project: <b>'{0}'</b> Expected end date").format(doc.name), EndDateCannotBeGreaterThanProjectEndDateError)
def validate_status(self):
if self.status!=self.get_db_value("status") and self.status == "Closed":

View File

@ -5,7 +5,7 @@ import frappe
import unittest
from frappe.utils import getdate, nowdate, add_days
from erpnext.projects.doctype.task.task import CircularReferenceError, EndDateCannotGreaterThanProjecteEndDateError
from erpnext.projects.doctype.task.task import CircularReferenceError, EndDateCannotBeGreaterThanProjectEndDateError
class TestTask(unittest.TestCase):
def test_circular_reference(self):
@ -102,7 +102,7 @@ class TestTask(unittest.TestCase):
pro = frappe.get_doc("Project", task_end.project)
pro.expected_end_date = add_days(nowdate(), 40)
pro.save()
self.assertRaises(EndDateCannotGreaterThanProjecteEndDateError, task_end.save)
self.assertRaises(EndDateCannotBeGreaterThanProjectEndDateError, task_end.save)