def add_comment(self, comment_type, text=None, comment_by=None, link_doctype=None, link_name=None):
		"""Add a comment to this document.

		:param comment_type: e.g. `Comment`. See Communication for more info."""

		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
dataset/ETHPy150Open frappe/frappe/frappe/model/document.py/Document.add_comment/original