Merge branch 'master' into edge
This commit is contained in:
commit
a67a84789f
7 changed files with 158 additions and 100 deletions
|
|
@ -1,8 +1,8 @@
|
|||
[
|
||||
{
|
||||
"creation": "2013-01-28 17:07:00",
|
||||
"creation": "2013-02-25 13:11:50",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-22 15:18:03",
|
||||
"modified": "2013-02-25 14:18:36",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
|
|
@ -104,12 +104,17 @@
|
|||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Administrator",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Report Manager",
|
||||
"write": 1
|
||||
|
|
|
|||
|
|
@ -1,184 +1,183 @@
|
|||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"creation": "2012-07-03 13:30:35",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-03-27 14:36:47",
|
||||
"modified": "2013-02-25 14:32:41",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-03-27 14:36:47"
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"show_in_menu": 0,
|
||||
"section_style": "Simple",
|
||||
"in_create": 1,
|
||||
"allow_attach": 0,
|
||||
"allow_copy": 0,
|
||||
"allow_email": 0,
|
||||
"allow_print": 0,
|
||||
"module": "Core",
|
||||
"allow_rename": 0,
|
||||
"autoname": "TDI.########",
|
||||
"doctype": "DocType",
|
||||
"allow_trash": 0,
|
||||
"use_template": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"in_create": 1,
|
||||
"in_dialog": 0,
|
||||
"issingle": 0,
|
||||
"allow_attach": 0,
|
||||
"read_only": 1,
|
||||
"allow_email": 0,
|
||||
"hide_heading": 0,
|
||||
"autoname": "TDI.########",
|
||||
"name": "__common__",
|
||||
"allow_rename": 0,
|
||||
"colour": "White:FFF",
|
||||
"is_transaction_doc": 0,
|
||||
"server_code_error": " ",
|
||||
"max_attachments": 0,
|
||||
"read_only_onload": 0,
|
||||
"version": 5,
|
||||
"hide_toolbar": 0,
|
||||
"allow_copy": 0
|
||||
"module": "Core",
|
||||
"name": "__common__",
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "ToDo",
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "ToDo",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"parent": "ToDo",
|
||||
"read": 1,
|
||||
"name": "__common__",
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"name": "__common__",
|
||||
"parent": "ToDo",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"role": "All",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
"read": 1
|
||||
},
|
||||
{
|
||||
"name": "ToDo",
|
||||
"doctype": "DocType"
|
||||
"doctype": "DocType",
|
||||
"name": "ToDo"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Text",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"width": "300px",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Description",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
"print_hide": 0,
|
||||
"print_width": "300px",
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Date",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Date",
|
||||
"oldfieldname": "date",
|
||||
"fieldname": "date",
|
||||
"fieldtype": "Date",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Date",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 0,
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Data",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Priority",
|
||||
"oldfieldname": "priority",
|
||||
"fieldname": "priority",
|
||||
"fieldtype": "Data",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Priority",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "priority",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 0,
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Data",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Reference Type",
|
||||
"oldfieldname": "reference_type",
|
||||
"fieldname": "reference_type",
|
||||
"fieldtype": "Data",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Reference Type",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "reference_type",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 0,
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Data",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Reference Name",
|
||||
"oldfieldname": "reference_name",
|
||||
"fieldname": "reference_name",
|
||||
"fieldtype": "Data",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Reference Name",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "reference_name",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 0,
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Check",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Checked",
|
||||
"oldfieldname": "checked",
|
||||
"fieldname": "checked",
|
||||
"fieldtype": "Check",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Checked",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "checked",
|
||||
"oldfieldtype": "Check",
|
||||
"print_hide": 0,
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
"label": "Role",
|
||||
"oldfieldname": "role",
|
||||
"fieldname": "role",
|
||||
"fieldtype": "Link",
|
||||
"search_index": 0,
|
||||
"reqd": 0,
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"label": "Role",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "role",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Role",
|
||||
"print_hide": 0,
|
||||
"report_hide": 0,
|
||||
"in_filter": 0
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Assigned By",
|
||||
"fieldname": "assigned_by",
|
||||
"fieldtype": "Link",
|
||||
"label": "Assigned By",
|
||||
"options": "Profile"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"report": 0,
|
||||
"role": "All",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "System Manager"
|
||||
}
|
||||
]
|
||||
0
core/report/__init__.py
Normal file
0
core/report/__init__.py
Normal file
0
core/report/todo/__init__.py
Normal file
0
core/report/todo/__init__.py
Normal file
30
core/report/todo/todo.py
Normal file
30
core/report/todo/todo.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.widgets.reportview import execute as runreport
|
||||
from webnotes.utils import getdate
|
||||
|
||||
def execute(filters=None):
|
||||
priority_map = {"High": 3, "Medium": 2, "Low": 1}
|
||||
|
||||
todo_list = runreport(doctype="ToDo", fields=["name", "date", "description",
|
||||
"priority", "reference_type", "reference_name", "assigned_by", "owner"],
|
||||
filters=[["ToDo", "checked", "!=", 1]])
|
||||
|
||||
todo_list.sort(key=lambda todo: (priority_map.get(todo.priority, 0),
|
||||
todo.date and getdate(todo.date) or getdate("1900-01-01")), reverse=True)
|
||||
|
||||
columns = ["ID:Link/ToDo:90", "Priority::60", "Date:Date", "Description::150",
|
||||
"Assigned To/Owner:Link/Profile:120", "Assigned By:Link/Profile:120", "Reference::200"]
|
||||
|
||||
result = []
|
||||
for todo in todo_list:
|
||||
if todo.reference_type:
|
||||
todo.reference = """<a href="#Form/%s/%s">%s: %s</a>""" % \
|
||||
(todo.reference_type, todo.reference_name, todo.reference_type, todo.reference_name)
|
||||
else:
|
||||
todo.reference = None
|
||||
result.append([todo.name, todo.priority, todo.date, todo.description,
|
||||
todo.owner, todo.assigned_by, todo.reference])
|
||||
|
||||
return columns, result
|
||||
|
||||
21
core/report/todo/todo.txt
Normal file
21
core/report/todo/todo.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[
|
||||
{
|
||||
"creation": "2013-02-25 14:26:30",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-25 14:26:51",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "ToDo",
|
||||
"report_name": "ToDo",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "ToDo"
|
||||
}
|
||||
]
|
||||
|
|
@ -48,11 +48,14 @@ def get_form_params():
|
|||
|
||||
return data
|
||||
|
||||
def execute(doctype, query=None, filters=[], fields=None, docstatus=[],
|
||||
def execute(doctype, query=None, filters=None, fields=None, docstatus=None,
|
||||
group_by=None, order_by=None, limit_start=0, limit_page_length=50):
|
||||
|
||||
if query:
|
||||
return run_custom_query(query)
|
||||
|
||||
if not filters: filters = []
|
||||
if not docstatus: docstatus = []
|
||||
|
||||
args = prepare_args(doctype, filters, fields, docstatus, group_by, order_by)
|
||||
args.limit = add_limit(limit_start, limit_page_length)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue