def add_comment(self, comment_type, text=None, comment_by=None, link_doctype=None, link_name=None):

		comment = frappe.get_doc({
			"doctype":"Communication",
			"communication_type": "Comment",
			"sender": comment_by or frappe.session.user,
			"comment_type": comment_type,
			"reference_doctype": self.doctype,
			"reference_name": self.name,
			"content": text or comment_type,
			"link_doctype": link_doctype,
			"link_name": link_name
		}).insert(ignore_permissions=True)
		return comment
Add a comment to this document.
dataset/ETHPy150Open frappe/frappe/frappe/model/document.py/Document.add_comment