[gantt] Gantt fixes (#6490)

* [gantt] fix Gantt Chart link in Modules

* [gantt] added field for Task dependent
This commit is contained in:
Faris Ansari 2016-10-10 14:32:35 +05:30 committed by Rushabh Mehta
parent ac5b193100
commit a0608d463a
6 changed files with 74 additions and 31 deletions

View File

@ -19,7 +19,7 @@ def get_data():
},
{
"type": "report",
"route": "Gantt/Task",
"route": "List/Task/Gantt",
"doctype": "Task",
"name": "Gantt Chart",
"description": _("Gantt chart of all tasks.")

View File

@ -334,3 +334,4 @@ erpnext.patches.v7_1.update_portal_roles
erpnext.patches.v7_1.set_total_amount_currency_in_je
finally:erpnext.patches.v7_0.update_timesheet_communications
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
erpnext.patches.v7_1.add_field_for_task_dependent

View File

@ -0,0 +1,9 @@
import frappe
def execute():
frappe.reload_doctype('Task')
for t in frappe.get_all('Task', fields=['name']):
task = frappe.get_doc('Task', t.name)
task.update_depends_on()
if task.depends_on_tasks:
task.db_set('depends_on_tasks', task.depends_on_tasks, update_modified=False)

View File

@ -282,6 +282,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "progress",
"fieldtype": "Percent",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Progress",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -390,6 +416,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "depends_on_tasks",
"fieldtype": "Read Only",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "depends_on_tasks",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -475,32 +527,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "progress",
"fieldtype": "Percent",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Progress",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -828,7 +854,7 @@
"istable": 0,
"max_attachments": 5,
"menu_index": 0,
"modified": "2016-09-22 18:16:50.339542",
"modified": "2016-10-03 15:12:56.078675",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task",
@ -844,6 +870,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,

View File

@ -29,6 +29,7 @@ class Task(Document):
def validate(self):
self.validate_dates()
self.validate_status()
self.update_depends_on()
def validate_dates(self):
if self.exp_start_date and self.exp_end_date and getdate(self.exp_start_date) > getdate(self.exp_end_date):
@ -46,6 +47,12 @@ class Task(Document):
from frappe.desk.form.assign_to import clear
clear(self.doctype, self.name)
def update_depends_on(self):
depends_on_tasks = ""
for d in self.depends_on:
depends_on_tasks += d.task + ","
self.depends_on_tasks = depends_on_tasks
def on_update(self):
self.check_recursion()
self.reschedule_dependent_tasks()
@ -156,5 +163,3 @@ def set_tasks_as_overdue():
and exp_end_date < CURDATE()
and `status` not in ('Closed', 'Cancelled')""")

View File

@ -1,5 +1,6 @@
frappe.listview_settings['Task'] = {
add_fields: ["project", "status", "priority", "exp_start_date", "exp_end_date", "subject", "progress"],
add_fields: ["project", "status", "priority", "exp_start_date",
"exp_end_date", "subject", "progress", "depends_on_tasks"],
filters: [["status", "=", "Open"]],
onload: function(listview) {
var method = "erpnext.projects.doctype.task.task.set_multiple_status";