[fix] [wip] cleanup for collaborative pm

This commit is contained in:
Rushabh Mehta 2016-03-25 17:19:28 +05:30
parent cd4bede04f
commit c20c536f28
25 changed files with 376 additions and 340 deletions

View File

@ -2692,7 +2692,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-21 13:13:43.694604",
"modified": "2016-03-25 07:32:03.043734",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
@ -2738,26 +2738,6 @@
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Supplier",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 1,
"apply_user_permissions": 0,
@ -2825,5 +2805,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "supplier",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -3418,7 +3418,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-21 13:12:12.430038",
"modified": "2016-03-25 07:31:46.017116",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
@ -3464,26 +3464,6 @@
"submit": 1,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Customer",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -3531,5 +3511,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "customer",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -2693,7 +2693,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-03-21 13:13:07.334625",
"modified": "2016-03-25 07:32:01.820327",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
@ -2759,26 +2759,6 @@
"submit": 1,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Supplier",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -2806,5 +2786,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "supplier",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -1780,7 +1780,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-16 15:36:05.481917",
"modified": "2016-03-25 07:32:02.711099",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation",
@ -1866,26 +1866,6 @@
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Supplier",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -1913,5 +1893,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "supplier",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -257,4 +257,5 @@ erpnext.patches.v6_20x.set_compact_print
execute:frappe.delete_doc_if_exists("Web Form", "contact") #2016-03-10
erpnext.patches.v6_20x.remove_fiscal_year_from_holiday_list
erpnext.patches.v6_24.map_customer_address_to_shipping_address_on_po
erpnext.patches.v6_27.fix_recurring_order_status
erpnext.patches.v6_27.fix_recurring_order_status
erpnext.patches.v6_20x.remove_customer_supplier_roles

View File

@ -0,0 +1,18 @@
from __future__ import unicode_literals
import frappe
def execute():
for role in ('Customer', 'Supplier'):
frappe.db.sql('''delete from `tabUserRole`
where role=%s and parent in ("Administrator", "Guest")''', role)
if not frappe.db.sql('select name from `tabUserRole` where role=%s', role):
# delete DocPerm
for doctype in frappe.db.sql('select parent from tabDocPerm where role=%s', role):
d = frappe.get_doc("DocType", doctype[0])
d.permissions = [p for p in d.permissions if p.role != role]
d.save()
# delete Role
frappe.delete_doc_if_exists('Role', role)

View File

@ -323,6 +323,57 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "users_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Users",
"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,
"collapsible": 0,
"fieldname": "users",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Users",
"length": 0,
"no_copy": 0,
"options": "Project User",
"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,
@ -921,7 +972,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 4,
"modified": "2016-03-15 05:10:21.779365",
"modified": "2016-03-25 06:46:29.485193",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",
@ -972,5 +1023,6 @@
"read_only_onload": 0,
"search_fields": "customer, status, priority, is_active",
"sort_order": "DESC",
"timeline_field": "customer"
"timeline_field": "customer",
"track_seen": 1
}

View File

@ -123,19 +123,30 @@ class Project(Document):
from `tabPurchase Invoice Item` where project = %s and docstatus=1""", self.name)
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20):
from frappe.templates.pages.list import get_list
return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=True)
return frappe.db.sql('''select distinct project.*
from tabProject project, `tabProject User` project_user
where
(project_user.user = %(user)s
and project_user.parent = project.name)
or project.owner = %(user)s
order by project.modified desc
limit {0}, {1}
'''.format(limit_start, limit_page_length),
{'user':frappe.session.user},
as_dict=True,
update={'doctype':'Project'})
def get_list_context(context=None):
return {
"title": _("My Projects"),
"get_list": get_project_list,
"row_template": "templates/includes/project_row.html"
}
@frappe.whitelist()
def get_cost_center_name(project):
return frappe.db.get_value("Project", project, "cost_center")

View File

@ -0,0 +1,58 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2016-03-25 02:52:19.283003",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "user",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "User",
"length": 0,
"no_copy": 0,
"options": "User",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-03-25 03:01:08.629640",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project User",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ProjectUser(Document):
pass

View File

@ -17,6 +17,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Subject",
@ -42,6 +43,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Project",
@ -68,6 +70,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -93,6 +96,7 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Status",
@ -119,6 +123,7 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Priority",
@ -145,6 +150,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -168,6 +174,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Expected Start Date",
@ -195,6 +202,7 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Expected Time (in hours)",
@ -220,6 +228,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -243,6 +252,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Expected End Date",
@ -268,6 +278,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -292,6 +303,7 @@
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Details",
@ -319,6 +331,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Depends On",
@ -343,6 +356,7 @@
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "depends_on",
@ -369,6 +383,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
@ -395,6 +410,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Actual Start Date (via Time Logs)",
@ -422,6 +438,7 @@
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Actual Time (in hours)",
@ -447,6 +464,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -470,6 +488,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Actual End Date (via Time Logs)",
@ -495,6 +514,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -518,6 +538,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Costing Amount (via Time Logs)",
@ -544,6 +565,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Expense Claim (via Expense Claim)",
@ -569,6 +591,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -592,6 +615,7 @@
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Billing Amount (via Time Logs)",
@ -616,6 +640,7 @@
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
@ -640,6 +665,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Review Date",
@ -666,6 +692,7 @@
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Closing Date",
@ -691,6 +718,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@ -713,6 +741,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
@ -741,7 +770,7 @@
"istable": 0,
"max_attachments": 5,
"menu_index": 0,
"modified": "2016-02-03 01:11:46.043538",
"modified": "2016-03-25 05:27:03.346334",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task",
@ -773,5 +802,6 @@
"search_fields": "subject",
"sort_order": "DESC",
"timeline_field": "project",
"title_field": "subject"
"title_field": "subject",
"track_seen": 1
}

View File

@ -2129,7 +2129,7 @@
"istable": 0,
"max_attachments": 1,
"menu_index": 0,
"modified": "2016-03-03 06:30:26.308629",
"modified": "2016-03-25 07:31:44.251525",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
@ -2176,27 +2176,6 @@
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"match": "",
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Customer",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -2327,5 +2306,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "customer",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -3018,7 +3018,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-03-21 13:11:32.654873",
"modified": "2016-03-25 07:31:45.471702",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",
@ -3104,26 +3104,6 @@
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Customer",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -3171,5 +3151,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "customer",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -2799,7 +2799,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-18 05:10:56.813113",
"modified": "2016-03-25 07:31:44.919162",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
@ -2885,26 +2885,6 @@
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Customer",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -2932,5 +2912,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "customer",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -2416,7 +2416,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-03-16 15:52:17.581445",
"modified": "2016-03-25 07:32:02.276482",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",
@ -2502,26 +2502,6 @@
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Supplier",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -2549,5 +2529,6 @@
"sort_field": "modified",
"sort_order": "DESC",
"timeline_field": "supplier",
"title_field": "title"
"title_field": "title",
"track_seen": 0
}

View File

@ -702,32 +702,12 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-03-23 07:40:21.423217",
"modified": "2016-03-25 07:31:44.715945",
"modified_by": "Administrator",
"module": "Support",
"name": "Issue",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 1,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Customer",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
@ -754,5 +734,6 @@
"search_fields": "status,customer,subject,raised_by",
"sort_order": "ASC",
"timeline_field": "customer",
"title_field": "subject"
"title_field": "subject",
"track_seen": 0
}

View File

@ -13,6 +13,18 @@
padding-bottom: 5px;
}
#project-search {
border: none;
}
.task-link {
font-weight: bold;
}
.task-link.seen {
font-weight: normal;
}
.row-header {
font-size: 14px;
font-weight: 500;
@ -136,7 +148,7 @@ float: right;*/
color: #fff;
}
.timeline-centered .timeline-entry .timeline-entry-inner .timeline-label {
position: relative;
background: #f5f5f6;

View File

@ -1,2 +1,2 @@
{% macro back_link(doc) %}&back-to=/projects?project={{ doc.name }}|{{ doc.project_name }}{% endmacro %}
{% macro back_link(doc) %}&back-to=/projects?project={{ doc.name }}&back-to-title={{ doc.project_name }}{% endmacro %}

View File

@ -4,7 +4,7 @@
<div class='issue'>
<div class='row project-item'>
<div class='col-xs-9'>
<a class="no-decoration" href="/issues-view?name={{ issue.name}}{{ back_link(doc) }}">
<a class="no-decoration" href="/issues?name={{ issue.name}}{{ back_link(doc) }}">
<span class="indicator {{ "red" if issue.status=="Open" else "green" }}">
{% if issue.status == "Closed" %}
{{ issue.subject }} resolved {{ frappe.utils.pretty_date(issue.resolution_date) }}

View File

@ -1,7 +1,8 @@
<div class="project-search">
<input type="text" id="project-search"
placeholder="Search..."><span style="position:relative;
left:-19px;"> <a href="/projects?project={{doc.name}}" class="octicon octicon-x text-extra-muted" title="Clear" ></a> </span>
placeholder="Search...">
<span style="position:relative;
left:-19px;"> <a href="/projects?project={{doc.name}}" class="octicon octicon-x text-extra-muted" title="Clear" ></a> </span>
</div>
<script>

View File

@ -4,23 +4,20 @@
<div class='task'>
<div class='row project-item'>
<div class='col-xs-9'>
<a class="no-decoration" href="/tasks?name={{ task.name }}{{ back_link(doc) }}">
<span class="indicator {{ "orange" if task.status=="Open" else "green" }}">
{% if task.status == "Closed" %}
{{ task.subject }} completed on {{ task.closing_date }}
{% else %}
{{ task.subject }}
{% endif %}
</span>
</a>
</div>
<div class='col-xs-3'>
<div class='pull-right'>
{% if task.todo %} <span class="avatar avatar-small" title="{{ task.todo.owner }}"> <img src="{{ task.todo.user_image }}"></span>
{% if task.todo %}
<span class="avatar avatar-small" title="{{ task.todo.owner }}">
<img src="{{ task.todo.user_image }}">
</span>
{% else %}
<span class="avatar avatar-small avatar-empty"></span>
{% endif %}
<a class="no-decoration task-link {{ task.css_seen }}" href="/tasks?name={{ task.name }}{{ back_link(doc) }}">
{% if task.status == "Closed" %}
{{ task.subject }} completed on {{ task.closing_date }}
{% else %}
<span class="avatar avatar-small avatar-empty"></span>
{{ task.subject }}
{% endif %}
</div>
</a>
</div>
</div>
</div>

View File

@ -30,9 +30,9 @@
{% block page_content %}
{% include 'templates/includes/project_search_box.html' %}
{% include 'templates/includes/projects/project_search_box.html' %}
{% if frappe.form_dict.q %}
<!-- {% if frappe.form_dict.q %}
<p class="text-muted"> <a href="/projects?project={{doc.name}}" class="text-muted">
Filtered by "{{ frappe.form_dict.q }}" Clear</a></p>
{% else %}
@ -43,56 +43,48 @@
{% if doc.timelines|length > 9 %}
<p><a class='more-timelines small underline'>{{ _("More") }}</a><p>
{% endif %}
{% endif %}
{% endif %} -->
<div class='padding'></div>
<h3>{{ _("Tasks") }}</h3>
<p>
<a class='small underline' href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
<a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
</p>
{% if doc.tasks %}
<div class='project-tasks-section'>
<div>
<div class="btn-group btn-toggle">
<button class="btn btn-link btn-open-tasks"><span class="indicator orange"></span>Open</button>
<button class="btn btn-link btn-closed-tasks"><span class="indicator green"></span>Closed</button>
</div>
<div class="pull-right">
<a class='small underline' href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
</div>
</div>
<div class='project-tasks'>
<div class='project-task-section'>
<div class='project-task'>
{% include "erpnext/templates/includes/projects/project_tasks.html" %}
</div>
<p><a id= 'more-tasks' style='display: none;' class='more-tasks small underline'>{{ _("More") }}</a><p>
<p><a id= 'more-task' style='display: none;' class='more-tasks small underline'>{{ _("More") }}</a><p>
</div>
{% else %}
<p class="text-muted">No tasks</p>
{% endif %}
<div class='padding'></div>
<!-- <div class='padding'></div>
<h3>{{ _("Issues") }}</h3>
<p>
<a class='small underline' href='/issues?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New issue</a>
<a class='small underline issue-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
</p>
{% if doc.issues %}
<div class='project-issues-section'>
<div>
<div class="btn-group btn-toggle">
<button class="btn btn-link btn-open-issues"><span class="indicator red"></span>Open</button>
<button class="btn btn-link btn-closed-issues"><span class="indicator green"></span>Closed</button>
</div>
<div class="pull-right">
<a class='small underline' href='/issues?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New issue</a>
</div>
</div>
<div class='project-issues'>
<div class='project-issue-section'>
<div class='project-issue'>
{% include "erpnext/templates/includes/projects/project_issues.html" %}
</div>
<p><a id='more-issues' style='display: none;' class='more-issues small underline'>{{ _("More") }}</a><p>
<p><a id='more-issue' style='display: none;' class='more-issues small underline'>{{ _("More") }}</a><p>
</div>
{% else %}
<p class="text-muted">No Issues</p>
{% endif %}
{% endif %} -->
<div class='padding'></div>

View File

@ -1,53 +1,60 @@
frappe.ready(function() {
$( window ).load(function() {
$(".btn-open-tasks").click();
$(".btn-open-issues").click();
});
$('.btn-closed-tasks').click(function() {
reload_items('closed','tasks');
});
$('.btn-open-tasks').click(function() {
reload_items('open','tasks');
});
$('.btn-closed-issues').click(function() {
reload_items('closed','issues');
});
$('.btn-open-issues').click(function() {
reload_items('open','issues');
});
$('.task-status-switch').on('click', function() {
var $btn = $(this);
if($btn.attr('data-status')==='Open') {
reload_items('closed', 'task', $btn);
} else {
reload_items('open', 'task', $btn);
}
})
$('.issue-status-switch').on('click', function() {
var $btn = $(this);
if($btn.attr('data-status')==='Open') {
reload_items('closed', 'issue', $btn);
} else {
reload_items('open', 'issue', $btn);
}
})
//
// $('.btn-closed-tasks').click(function() {
// reload_items('closed','tasks');
// });
//
// $('.btn-open-tasks').click(function() {
// reload_items('open','tasks');
// });
//
// $('.btn-closed-issues').click(function() {
// reload_items('closed','issues');
// });
//
// $('.btn-open-issues').click(function() {
// reload_items('open','issues');
// });
var start = 10;
$(".more-tasks").click(function() {
more_items('tasks', true);
});
more_items('task', true);
});
$(".more-issues").click(function() {
more_items('issues', true);
});
more_items('issue', true);
});
$(".more-timelogs").click(function() {
more_items('timelogs', false);
});
more_items('timelog', false);
});
$(".more-timelines").click(function() {
more_items('timelines', false);
});
$( ".project-tasks" ).on('click', '.task-x', function() {
var item_name = $(this).attr('id');
close_item('task', item_name);
});
$( ".project-issues" ).on('click', '.issue-x', function() {
var item_name = $(this).attr('id');
close_item('issue', item_name);
});
var reload_items = function(item_status, item) {
more_items('timeline', false);
});
var reload_items = function(item_status, item, $btn) {
$.ajax({
method: "GET",
url: "/",
@ -59,25 +66,28 @@ frappe.ready(function() {
},
dataType: "json",
success: function(data) {
console.log(data.message);
if(typeof data.message == 'undefined') {
$('.project-'+ item).html("No "+ item_status +" "+ item);
if(typeof data.message == 'undefined') {
$('.project-'+ item).html("No "+ item_status +" "+ item);
$(".more-"+ item).toggle(false);
}
$('.project-'+ item).html(data.message);
$('.project-'+ item +'-section .btn-group .bold').removeClass('bold');
$('.btn-'+ item_status +'-'+ item).addClass( "bold" );
$(".more-"+ item).toggle(true);
// update status
if(item_status==='open') {
$btn.html(__('Show closed')).attr('data-status', 'Open');
} else {
$btn.html(__('Show open')).attr('data-status', 'Closed');
}
}
});
});
}
var more_items = function(item, item_status){
if(item_status)
{
var item_status = $('.project-'+ item +'-section .btn-group .bold').hasClass('btn-closed-'+ item)
var item_status = $('.project-'+ item +'-section .btn-group .bold').hasClass('btn-closed-'+ item)
? 'closed' : 'open';
}
$.ajax({
@ -92,21 +102,21 @@ frappe.ready(function() {
},
dataType: "json",
success: function(data) {
$(data.message).appendTo('.project-'+ item);
if(typeof data.message == 'undefined') {
$(".more-"+ item).toggle(false);
if(typeof data.message == 'undefined') {
$(".more-"+ item).toggle(false);
}
start = start+10;
}
});
});
}
var close_item = function(item, item_name){
var args = {
project: '{{ doc.name }}',
item_name: item_name,
}
}
frappe.call({
btn: this,
type: "POST",

View File

@ -15,11 +15,14 @@ def get_context(context):
context.issues = frappe.get_all('Issue', filters={'project': project.project_name},
fields=['subject', 'opening_date', 'resolution_date', 'status', 'name', 'resolution_details','modified','modified_by'])
project.tasks = get_tasks(project.name, start=0, search=frappe.form_dict.get("q"))
project.tasks = get_tasks(project.name, start=0, item_status='open',
search=frappe.form_dict.get("q"))
project.timelogs = get_timelogs(project.name, start=0, search=frappe.form_dict.get("q"))
project.issues = get_issues(project.name, start=0, item_status='open',
search=frappe.form_dict.get("q"))
project.issues = get_issues(project.name, start=0, search=frappe.form_dict.get("q"))
project.timelogs = get_timelogs(project.name, start=0,
search=frappe.form_dict.get("q"))
project.timelines = get_timeline(project.project_name, start=0)
@ -60,11 +63,15 @@ def get_timeline(project, start=10):
@frappe.whitelist()
def get_timelines_html(project, start=0):
return frappe.render_template("erpnext/templates/includes/projects/timeline.html",
{"doc": {"timelines": get_timeline(project, start)}}, is_path=True)
{"doc": {
"timelines": get_timeline(project, start)}
}, is_path=True)
def get_issue_list(project):
return [issue.name for issue in get_issues(project)]
def get_tasks(project, start=0, search=None, item_status=None):
filters = {"project": project}
if search:
@ -72,24 +79,37 @@ def get_tasks(project, start=0, search=None, item_status=None):
if item_status:
filters["status"] = item_status
tasks = frappe.get_all("Task", filters=filters,
fields=["name", "subject", "status", "exp_start_date", "exp_end_date", "priority"],
fields=["name", "subject", "status", "exp_start_date", "exp_end_date", "priority", "_seen"],
limit_start=start, limit_page_length=10)
for task in tasks:
print task._comments
task.todo = frappe.get_all('ToDo',filters={'reference_name':task.name, 'reference_type':'Task'},
fields=["assigned_by", "owner", "modified", "modified_by"])
if task.todo:
task.todo=task.todo[0]
task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image')
if task._comments:
task.comment_count = len(json.loads(task._comments or "[]"))
task.css_seen = ''
if task._seen:
if frappe.session.user in json.loads(task._seen):
task.css_seen = 'seen'
return tasks
@frappe.whitelist()
def get_tasks_html(project, start=0, item_status=None):
def get_task_html(project, start=0, item_status=None):
return frappe.render_template("erpnext/templates/includes/projects/project_tasks.html",
{"doc": {"tasks": get_tasks(project, start, item_status=item_status)}}, is_path=True)
{"doc": {
"name": project,
"project_name": project,
"tasks": get_tasks(project, start, item_status=item_status)}
}, is_path=True)
def get_issues(project, start=0, search=None, item_status=None):
@ -113,9 +133,17 @@ def get_issues(project, start=0, search=None, item_status=None):
return issues
@frappe.whitelist()
def get_issues_html(project, start=0, item_status=None):
def get_issue_html(project, start=0, item_status=None):
return frappe.render_template("erpnext/templates/includes/projects/project_issues.html",
{"doc": {"issues": get_issues(project, start, item_status=item_status)}}, is_path=True)
{"doc": {
"name": project,
"project_name": project,
"issues": get_issues(project, start, item_status=item_status)}
}, is_path=True)
def get_timelogs(project, start=0, search=None):
filters = {"project": project}
@ -130,19 +158,7 @@ def get_timelogs(project, start=0, search=None):
return timelogs
@frappe.whitelist()
def get_timelogs_html(project, start=0):
def get_timelog_html(project, start=0):
return frappe.render_template("erpnext/templates/includes/projects/project_timelogs.html",
{"doc": {"timelogs": get_timelogs(project, start)}}, is_path=True)
@frappe.whitelist()
def set_task_status(project, item_name):
task = frappe.get_doc("Task", item_name)
task.status = 'Closed'
task.save(ignore_permissions=True)
@frappe.whitelist()
def set_issue_status(project, item_name):
issue = frappe.get_doc("Issue", item_name)
issue.status = 'Closed'
issue.save(ignore_permissions=True)