fix(issue): Don't auto-set project

This commit is contained in:
Rohan Bansal 2019-02-15 14:21:10 +05:30
parent fa77b591ac
commit bf7c69f3c4
2 changed files with 7 additions and 13 deletions

View File

@ -3,13 +3,13 @@ frappe.ui.form.on("Issue", {
frm.email_field = "raised_by"; frm.email_field = "raised_by";
}, },
refresh: function(frm) { refresh: function (frm) {
frm.add_custom_button(__("Task"), function () { frm.add_custom_button(__("Task"), function () {
frappe.set_route("List", "Task", { "issue": frm.doc.name }); frappe.set_route("List", "Task", { "issue": frm.doc.name });
}, __("View")); }, __("View"));
if(frm.doc.status!=="Closed") { if (frm.doc.status !== "Closed") {
frm.add_custom_button(__("Close"), function() { frm.add_custom_button(__("Close"), function () {
frm.set_value("status", "Closed"); frm.set_value("status", "Closed");
frm.save(); frm.save();
}); });
@ -21,7 +21,7 @@ frappe.ui.form.on("Issue", {
}); });
}, __("Make")); }, __("Make"));
} else { } else {
frm.add_custom_button(__("Reopen"), function() { frm.add_custom_button(__("Reopen"), function () {
frm.set_value("status", "Open"); frm.set_value("status", "Open");
frm.save(); frm.save();
}); });

View File

@ -33,7 +33,7 @@ class Issue(Document):
clear(self.doctype, self.name) clear(self.doctype, self.name)
def on_update(self): def on_update(self):
# create the communication email and remove the description # Add a communication in the issue timeline
if self.flags.create_communication and self.via_customer_portal: if self.flags.create_communication and self.via_customer_portal:
self.create_communication() self.create_communication()
self.flags.communication_created = None self.flags.communication_created = None
@ -183,14 +183,8 @@ def update_issue(contact, method):
@frappe.whitelist() @frappe.whitelist()
def make_task(source_name, target_doc=None): def make_task(source_name, target_doc=None):
def set_missing_values(source, target): return get_mapped_doc("Issue", source_name, {
if not target.project:
target.project = frappe.db.get_value("Project", {"customer": source.customer})
doclist = get_mapped_doc("Issue", source_name, {
"Issue": { "Issue": {
"doctype": "Task" "doctype": "Task"
} }
}, target_doc, set_missing_values) }, target_doc)
return doclist