Website Listing

This commit is contained in:
Anand Doshi
2015-02-23 22:14:12 +05:30
parent a1da88a3d3
commit f9fc04ce8e
37 changed files with 256 additions and 487 deletions

View File

@@ -7,14 +7,12 @@ from frappe import _
from frappe.model.document import Document
from frappe.utils import now
from frappe.utils.user import is_website_user
class Issue(Document):
def get_feed(self):
return "{0}: {1}".format(_(self.status), self.subject)
def get_portal_page(self):
return "ticket"
def set_sender(self, sender):
"""Will be called by **Communication** when the Issue is created from an incoming email."""
self.raised_by = sender
@@ -50,6 +48,24 @@ class Issue(Document):
# if no date, it should be set as None and not a blank string "", as per mysql strict config
self.resolution_date = None
@staticmethod
def get_list_context(context=None):
return {
"title": _("My Issues"),
"get_list": get_issue_list
}
def get_issue_list(doctype, txt, filters, limit_start, limit_page_length=20):
from frappe.templates.pages.list import get_list
user = frappe.session.user
ignore_permissions = False
if is_website_user(user):
if not filters: filters = []
filters.append(("Issue", "raised_by", "=", user))
ignore_permissions = True
return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=ignore_permissions)
@frappe.whitelist()
def set_status(name, status):
st = frappe.get_doc("Issue", name)