Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

36 linhas
1.3 KiB

  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import webnotes
  5. from webnotes import _
  6. from webnotes.widgets.reportview import execute as runreport
  7. from webnotes.utils import getdate
  8. def execute(filters=None):
  9. priority_map = {"High": 3, "Medium": 2, "Low": 1}
  10. todo_list = runreport(doctype="ToDo", fields=["name", "date", "description",
  11. "priority", "reference_type", "reference_name", "assigned_by", "owner"],
  12. filters=[["ToDo", "checked", "!=", 1]])
  13. todo_list.sort(key=lambda todo: (priority_map.get(todo.priority, 0),
  14. todo.date and getdate(todo.date) or getdate("1900-01-01")), reverse=True)
  15. columns = [_("ID")+":Link/ToDo:90", _("Priority")+"::60", _("Date")+ ":Date",
  16. _("Description")+"::150", _("Assigned To/Owner") + ":Link/Profile:120",
  17. _("Assigned By")+":Link/Profile:120", _("Reference")+"::200"]
  18. result = []
  19. for todo in todo_list:
  20. if todo.reference_type:
  21. todo.reference = """<a href="#Form/%s/%s">%s: %s</a>""" % \
  22. (todo.reference_type, todo.reference_name, todo.reference_type, todo.reference_name)
  23. else:
  24. todo.reference = None
  25. result.append([todo.name, todo.priority, todo.date, todo.description,
  26. todo.owner, todo.assigned_by, todo.reference])
  27. return columns, result