From 9e008ce1cad1d918d6ea2c23da1467b56914743a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 8 Jun 2016 15:29:00 +0530 Subject: [PATCH] [fix] add communication in comments, fixes frappe/erpnext#5450 --- frappe/website/doctype/web_form/web_form.py | 5 +++-- frappe/website/utils.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frappe/website/doctype/web_form/web_form.py b/frappe/website/doctype/web_form/web_form.py index a2eec43a73..7b55ca9bdc 100644 --- a/frappe/website/doctype/web_form/web_form.py +++ b/frappe/website/doctype/web_form/web_form.py @@ -111,7 +111,8 @@ class WebForm(WebsiteGenerator): context.reference_name = context.doc.name if self.allow_comments and frappe.form_dict.name: - context.comment_list = get_comment_list(context.doc.doctype, context.doc.name) + context.comment_list = get_comment_list(context.doc.doctype, + context.doc.name) context.parents = self.get_parents(context) @@ -257,7 +258,7 @@ def has_web_form_permission(doctype, name, ptype='read'): else: return False - + def check_webform_perm(doctype, name): doc = frappe.get_doc(doctype, name) diff --git a/frappe/website/utils.py b/frappe/website/utils.py index c4d78696c7..41cfd86ec3 100644 --- a/frappe/website/utils.py +++ b/frappe/website/utils.py @@ -32,7 +32,7 @@ def get_comment_list(doctype, name): communication_type='Comment' and reference_doctype=%s and reference_name=%s - and (comment_type is null or comment_type='Comment') + and (comment_type is null or comment_type in ('Comment', 'Communication')) and modified >= DATE_SUB(NOW(),INTERVAL 1 YEAR) order by creation""", (doctype, name), as_dict=1) or []