fix: moved erpnext related methods from frappe to erpnext

This commit is contained in:
Rohit Waghchaure
2019-04-19 11:20:41 +05:30
parent 733ff48d51
commit 270d4e9f4e
4 changed files with 68 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ from frappe.model.mapper import get_mapped_doc
from frappe.utils.user import is_website_user
from ..service_level_agreement.service_level_agreement import get_active_service_level_agreement_for
from erpnext.crm.doctype.opportunity.opportunity import assign_to_user
from frappe.email.inbox import link_communication_to_document
sender_field = "raised_by"
@@ -294,3 +295,19 @@ def make_task(source_name, target_doc=None):
"doctype": "Task"
}
}, target_doc)
@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