Merge pull request #31100 from akhilnarang/fix-attach-child-table

fix: move child table checks to within `set_input()`
This commit is contained in:
Akhil Narang 2025-02-04 15:24:09 +05:30 committed by GitHub
commit c273c52092
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
}
}