diff --git a/frappe/client.py b/frappe/client.py index 591ef09631..299f0e6885 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -12,6 +12,7 @@ from frappe.desk.reportview import validate_args from frappe.model.db_query import check_parent_permission from frappe.model.utils import is_virtual_doctype from frappe.utils import get_safe_filters +from frappe.utils.caching import http_cache if TYPE_CHECKING: from frappe.model.document import Document @@ -385,6 +386,7 @@ def attach_file( @frappe.whitelist() +@http_cache(max_age=10 * 60) def is_document_amended(doctype, docname): if frappe.permissions.has_permission(doctype): try: diff --git a/frappe/public/js/frappe/form/toolbar.js b/frappe/public/js/frappe/form/toolbar.js index 663f403528..a0d2dcbb5f 100644 --- a/frappe/public/js/frappe/form/toolbar.js +++ b/frappe/public/js/frappe/form/toolbar.js @@ -660,10 +660,15 @@ frappe.ui.form.Toolbar = class Toolbar { if (status !== this.current_status && status === "Amend") { let doc = this.frm.doc; frappe - .xcall("frappe.client.is_document_amended", { - doctype: doc.doctype, - docname: doc.name, - }) + .xcall( + "frappe.client.is_document_amended", + { + doctype: doc.doctype, + docname: doc.name, + }, + "GET", + { cache: true } + ) .then((is_amended) => { if (is_amended) { this.page.clear_actions();