From e08fb1cff27527b5447c40308a1dd90d81b1411f Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Tue, 4 Feb 2025 12:42:29 +0530 Subject: [PATCH] fix: move child table checks to within `set_input()` Otherwise changes to the table can trigger this and allow uploading Signed-off-by: Akhil Narang --- frappe/public/js/frappe/form/controls/attach.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/frappe/public/js/frappe/form/controls/attach.js b/frappe/public/js/frappe/form/controls/attach.js index d1c83fb6b1..a87bc6583b 100644 --- a/frappe/public/js/frappe/form/controls/attach.js +++ b/frappe/public/js/frappe/form/controls/attach.js @@ -32,12 +32,6 @@ frappe.ui.form.ControlAttach = class ControlAttach extends frappe.ui.form.Contro frappe.utils.bind_actions_with_object(this.$value, this); this.toggle_reload_button(); - - // Don't allow attaching to child tables for new documents - if (this.doc?.__islocal && this.doc.parent) { - this.$input.prop("disabled", true); - this.$input.attr("title", __("Save to enable file upload")); - } } clear_attachment() { let me = this; @@ -125,7 +119,11 @@ frappe.ui.form.ControlAttach = class ControlAttach extends frappe.ui.form.Contro `); } } else { - this.$input.toggle(true); + // Don't allow attaching to child tables for new documents + if (this.doc?.__islocal && this.doc.parent) { + this.$input.prop("disabled", true); + this.$input.attr("title", __("Save to enable file upload")); + } this.$value.toggle(false); } }