mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-15 02:33:38 +00:00
fix: validate is_group for parent task
(cherry picked from commit ed1a1099cb)
# Conflicts:
# erpnext/projects/doctype/task/task.py
This commit is contained in:
committed by
Mergify
parent
8e199af118
commit
3380deab02
@@ -17,6 +17,10 @@ class CircularReferenceError(frappe.ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
class ParentIsGroupError(frappe.ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
class Task(NestedSet):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
@@ -83,6 +87,11 @@ class Task(NestedSet):
|
||||
self.update_depends_on()
|
||||
self.validate_dependencies_for_template_task()
|
||||
self.validate_completed_on()
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
self.set_default_end_date_if_missing()
|
||||
self.validate_parent_is_group()
|
||||
>>>>>>> ed1a1099cb (fix: validate is_group for parent task)
|
||||
|
||||
def validate_dates(self):
|
||||
self.validate_from_to_dates("exp_start_date", "exp_end_date")
|
||||
@@ -167,6 +176,14 @@ class Task(NestedSet):
|
||||
if self.completed_on and getdate(self.completed_on) > getdate():
|
||||
frappe.throw(_("Completed On cannot be greater than Today"))
|
||||
|
||||
def validate_parent_is_group(self):
|
||||
if self.parent_task:
|
||||
if not frappe.db.get_value("Task", self.parent_task, "is_group"):
|
||||
parent_task_format = f"""<a href="/app/task/{self.parent_task}">{self.parent_task}</a>"""
|
||||
frappe.throw(
|
||||
_("Parent Task {0} must be a Group Task").format(parent_task_format), ParentIsGroupError
|
||||
)
|
||||
|
||||
def update_depends_on(self):
|
||||
depends_on_tasks = ""
|
||||
for d in self.depends_on:
|
||||
|
||||
Reference in New Issue
Block a user