mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-28 01:14:46 +00:00
fix: Added parent task expected end date validation (#24889)
This commit is contained in:
@@ -30,6 +30,7 @@ class Task(NestedSet):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_dates()
|
self.validate_dates()
|
||||||
|
self.validate_parent_expected_end_date()
|
||||||
self.validate_parent_project_dates()
|
self.validate_parent_project_dates()
|
||||||
self.validate_progress()
|
self.validate_progress()
|
||||||
self.validate_status()
|
self.validate_status()
|
||||||
@@ -44,6 +45,12 @@ class Task(NestedSet):
|
|||||||
frappe.throw(_("{0} can not be greater than {1}").format(frappe.bold("Actual Start Date"), \
|
frappe.throw(_("{0} can not be greater than {1}").format(frappe.bold("Actual Start Date"), \
|
||||||
frappe.bold("Actual End Date")))
|
frappe.bold("Actual End Date")))
|
||||||
|
|
||||||
|
def validate_parent_expected_end_date(self):
|
||||||
|
if self.parent_task:
|
||||||
|
parent_exp_end_date = frappe.db.get_value("Task", self.parent_task, "exp_end_date")
|
||||||
|
if parent_exp_end_date and getdate(self.get("exp_end_date")) > getdate(parent_exp_end_date):
|
||||||
|
frappe.throw(_("Expected End Date should be less than or equal to parent task's Expected End Date {0}.").format(getdate(parent_exp_end_date)))
|
||||||
|
|
||||||
def validate_parent_project_dates(self):
|
def validate_parent_project_dates(self):
|
||||||
if not self.project or frappe.flags.in_test:
|
if not self.project or frappe.flags.in_test:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user