Make the communication from the issue webform (#14015)
This commit is contained in:
committed by
Rushabh Mehta
parent
292f46fec0
commit
1b48fde986
@@ -926,6 +926,37 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "via_customer_portal",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Via Customer Portal",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"has_web_view": 0,
|
"has_web_view": 0,
|
||||||
@@ -939,7 +970,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-04-13 13:03:14.748090",
|
"modified": "2018-05-07 05:53:20.684275",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Support",
|
"module": "Support",
|
||||||
"name": "Issue",
|
"name": "Issue",
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ class Issue(Document):
|
|||||||
return "{0}: {1}".format(_(self.status), self.subject)
|
return "{0}: {1}".format(_(self.status), self.subject)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
if (self.get("__islocal") and self.via_customer_portal):
|
||||||
|
self.flags.create_communication = True
|
||||||
if not self.raised_by:
|
if not self.raised_by:
|
||||||
self.raised_by = frappe.session.user
|
self.raised_by = frappe.session.user
|
||||||
self.update_status()
|
self.update_status()
|
||||||
@@ -26,6 +28,12 @@ class Issue(Document):
|
|||||||
from frappe.desk.form.assign_to import clear
|
from frappe.desk.form.assign_to import clear
|
||||||
clear(self.doctype, self.name)
|
clear(self.doctype, self.name)
|
||||||
|
|
||||||
|
def on_update(self):
|
||||||
|
# create the communication email and remove the description
|
||||||
|
if (self.flags.create_communication and self.via_customer_portal):
|
||||||
|
self.create_communication()
|
||||||
|
self.flags.communication_created = None
|
||||||
|
|
||||||
def set_lead_contact(self, email_id):
|
def set_lead_contact(self, email_id):
|
||||||
import email.utils
|
import email.utils
|
||||||
email_id = email.utils.parseaddr(email_id)[1]
|
email_id = email.utils.parseaddr(email_id)[1]
|
||||||
@@ -53,6 +61,26 @@ class Issue(Document):
|
|||||||
# if no date, it should be set as None and not a blank string "", as per mysql strict config
|
# if no date, it should be set as None and not a blank string "", as per mysql strict config
|
||||||
self.resolution_date = None
|
self.resolution_date = None
|
||||||
|
|
||||||
|
def create_communication(self):
|
||||||
|
communication = frappe.new_doc("Communication")
|
||||||
|
communication.update({
|
||||||
|
"communication_type": "Communication",
|
||||||
|
"communication_medium": "Email",
|
||||||
|
"sent_or_received": "Received",
|
||||||
|
"email_status": "Open",
|
||||||
|
"subject": self.subject,
|
||||||
|
"sender": self.raised_by,
|
||||||
|
"content": self.description,
|
||||||
|
"status": "Linked",
|
||||||
|
"reference_doctype": "Issue",
|
||||||
|
"reference_name": self.name
|
||||||
|
})
|
||||||
|
communication.ignore_permissions = True
|
||||||
|
communication.ignore_mandatory = True
|
||||||
|
communication.save()
|
||||||
|
|
||||||
|
self.db_set("description", "")
|
||||||
|
|
||||||
def get_list_context(context=None):
|
def get_list_context(context=None):
|
||||||
return {
|
return {
|
||||||
"title": _("Issues"),
|
"title": _("Issues"),
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"is_standard": 1,
|
"is_standard": 1,
|
||||||
"login_required": 1,
|
"login_required": 1,
|
||||||
"max_attachment_size": 0,
|
"max_attachment_size": 0,
|
||||||
"modified": "2017-07-25 22:49:10.762704",
|
"modified": "2018-05-07 05:54:22.213127",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Support",
|
"module": "Support",
|
||||||
"name": "issues",
|
"name": "issues",
|
||||||
@@ -83,6 +83,17 @@
|
|||||||
"max_value": 0,
|
"max_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 0
|
"reqd": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "1",
|
||||||
|
"fieldname": "via_customer_portal",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Via Customer Portal",
|
||||||
|
"max_length": 0,
|
||||||
|
"max_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"reqd": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -4,4 +4,5 @@ import frappe
|
|||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
# do your magic here
|
# do your magic here
|
||||||
pass
|
if context.doc:
|
||||||
|
context.read_only = 1
|
||||||
Reference in New Issue
Block a user