fix: Move erpnext related methods from frappe to erpnext (#17293)

This commit is contained in:
rohitwaghchaure
2019-04-20 11:50:45 +05:30
committed by Faris Ansari
parent f665e42e2a
commit 4e81fb20b9
4 changed files with 70 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ from frappe import _
from frappe.model.document import Document
from frappe.utils import now
from frappe.utils.user import is_website_user
from frappe.email.inbox import link_communication_to_document
sender_field = "raised_by"
@@ -160,3 +161,20 @@ def has_website_permission(doc, ptype, user, verbose=False):
def update_issue(contact, method):
"""Called when Contact is deleted"""
frappe.db.sql("""UPDATE `tabIssue` set contact='' where contact=%s""", contact.name)
@frappe.whitelist()
def make_issue_from_communication(communication, ignore_communication_links=False):
""" raise a issue from email """
doc = frappe.get_doc("Communication", communication)
issue = frappe.get_doc({
"doctype": "Issue",
"subject": doc.subject,
"communication_medium": doc.communication_medium,
"raised_by": doc.sender or "",
"raised_by_phone": doc.phone_no or ""
}).insert(ignore_permissions=True)
link_communication_to_document(doc, "Issue", issue.name, ignore_communication_links)
return issue.name