diff --git a/frappe/core/doctype/communication/communication.js b/frappe/core/doctype/communication/communication.js index 10f88f569f..7bc5e0904c 100644 --- a/frappe/core/doctype/communication/communication.js +++ b/frappe/core/doctype/communication/communication.js @@ -204,13 +204,13 @@ frappe.ui.form.on("Communication", { }, mark_as_closed_open: function(frm) { - var action = frm.doc.status == "Open" ? "Close" : "Open"; + var status = frm.doc.status == "Open" ? "Closed" : "Open"; return frappe.call({ method: "frappe.email.inbox.mark_as_closed_open", args: { communication: frm.doc.name, - action: action + status: status }, freeze: true, callback: function(r) { diff --git a/frappe/email/inbox.py b/frappe/email/inbox.py index ce4982d6af..395a2d3e2d 100644 --- a/frappe/email/inbox.py +++ b/frappe/email/inbox.py @@ -97,12 +97,9 @@ def create_email_flag_queue(names, action): mark_as_seen_unseen(name, action) @frappe.whitelist() -def mark_as_closed_open(communication, action): +def mark_as_closed_open(communication, status): """Set status to open or close""" - if action == "Close": - frappe.db.set_value("Communication", communication, "status", "Closed") - else: - frappe.db.set_value("Communication", communication, "status", "Open") + frappe.db.set_value("Communication", communication, "status", status) @frappe.whitelist() def move_email(communication, email_account): @@ -131,4 +128,4 @@ def link_communication_to_document(doc, reference_doctype, reference_name, ignor doc.reference_doctype = reference_doctype doc.reference_name = reference_name doc.status = "Linked" - doc.save(ignore_permissions=True) \ No newline at end of file + doc.save(ignore_permissions=True)